From ac054594dcc18b3793be3df70f260683cad90fb6 Mon Sep 17 00:00:00 2001 From: "Tom G. Christensen" Date: Tue, 25 Mar 2008 14:41:08 +0000 Subject: [PATCH] Enforce length limits on PKG and NAME fields in pkginfo --- buildpkg.functions | 4 ++++ buildpkg.packaging.solaris | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/buildpkg.functions b/buildpkg.functions index 74a39ec..50c89ba 100644 --- a/buildpkg.functions +++ b/buildpkg.functions @@ -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 diff --git a/buildpkg.packaging.solaris b/buildpkg.packaging.solaris index 7a25202..a57b8ad 100644 --- a/buildpkg.packaging.solaris +++ b/buildpkg.packaging.solaris @@ -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" \