diff options
author | Brian Carlstrom <bdc@google.com> | 2014-07-29 16:08:25 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-07-29 16:13:18 -0700 |
commit | dad2ab4df403125873940d50c80f2db8217b4916 (patch) | |
tree | 5a555259b20d82be8d11cd03146c1c967126fe0d /tools/post_process_props.py | |
parent | ecc4267564116197b719baf9ecc24a9f0652fbb5 (diff) | |
download | build-dad2ab4df403125873940d50c80f2db8217b4916.zip build-dad2ab4df403125873940d50c80f2db8217b4916.tar.gz build-dad2ab4df403125873940d50c80f2db8217b4916.tar.bz2 |
Add PROP_NAME_MAX validation
Change-Id: I49179c83ae163de6f6fb398c5de60c5d296ca009
Diffstat (limited to 'tools/post_process_props.py')
-rwxr-xr-x | tools/post_process_props.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/post_process_props.py b/tools/post_process_props.py index 5d1b350..32a90bc 100755 --- a/tools/post_process_props.py +++ b/tools/post_process_props.py @@ -16,9 +16,10 @@ import sys -# See PROP_VALUE_MAX system_properties.h. -# PROP_VALUE_MAX in system_properties.h includes the termination NUL, -# so we decrease it by 1 here. +# See PROP_NAME_MAX and PROP_VALUE_MAX system_properties.h. +# The constants in system_properties.h includes the termination NUL, +# so we decrease the values by 1 here. +PROP_NAME_MAX = 31 PROP_VALUE_MAX = 91 # Put the modifications that you need to make into the /system/build.prop into this @@ -56,6 +57,11 @@ def validate(prop): "").startswith("eng") for key, value in buildprops.iteritems(): # Check build properties' length. + if len(key) > PROP_NAME_MAX: + check_pass = False + sys.stderr.write("error: %s cannot exceed %d bytes: " % + (key, PROP_NAME_MAX)) + sys.stderr.write("%s (%d)\n" % (key, len(key))) if len(value) > PROP_VALUE_MAX: # If dev build, show a warning message, otherwise fail the # build with error message |