Enforce length limits on PKG and NAME fields in pkginfo
This commit is contained in:
parent
951d5ac6de
commit
ac054594dc
@ -188,6 +188,8 @@ E_BAD_SECTION_END=44
|
||||
E_UNPACKAGED_FILES=45
|
||||
E_BAD_VERSION=46
|
||||
E_BAD_LIBS=47
|
||||
E_SVR4_PKG_OVERFLOW=48
|
||||
E_SVR4_NAME_OVERFLOW=49
|
||||
|
||||
error_txt[$E_BAD_FILE]="File not found"
|
||||
error_txt[$E_PATCH_FAILED]="Patch failed"
|
||||
@ -204,6 +206,8 @@ error_txt[$E_BAD_SECTION_END]="Found end of section marker before section begin!
|
||||
error_txt[$E_UNPACKAGED_FILES]="Unpackaged files found in stage area!"
|
||||
error_txt[$E_BAD_VERSION]="Version field overflow"
|
||||
error_txt[$E_BAD_LIBS]="config.log defines obsolete libraries!"
|
||||
error_txt[$E_SVR4_PKG_OVERFLOW]="PKG field exceeds 9 char limit"
|
||||
error_txt[$E_SVR4_NAME_OVERFLOW]="NAME field exceeds 256 char limit"
|
||||
|
||||
#####################################################
|
||||
# Helper functions
|
||||
|
@ -113,6 +113,10 @@ pack_info()
|
||||
|
||||
local pstamp="$os-$($UNAME -n)`date '+%Y%m%d%H%M'`"
|
||||
|
||||
# Check length of pkgname and name to make sure we're within limits
|
||||
[ ${#pkgname} -gt 9 ] && error $E_SVR4_PKG_OVERFLOW pack_info
|
||||
[ ${#name} -gt 256 ] && error $E_SVR4_NAME_OVERFLOW pack_info
|
||||
|
||||
$SED -e "s#%%pkgname%%#$pkgname#g" \
|
||||
-e "s#%%version%%#$version#g" \
|
||||
-e "s#%%pkgcat%%#$pkgcat#g" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user