summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-09-16 11:30:48 -0700
committerNick Kralevich <nnk@google.com>2013-09-16 11:32:37 -0700
commitc2c5a2410a2d7861d3c4f07f039eb8c471741cfa (patch)
tree4f96d27c7266fdf63ec8dc8a4699a18955fe7620 /init
parentdb3f6ef829e6c463c6c15746e64525c76b4c10e1 (diff)
downloadsystem_core-c2c5a2410a2d7861d3c4f07f039eb8c471741cfa.zip
system_core-c2c5a2410a2d7861d3c4f07f039eb8c471741cfa.tar.gz
system_core-c2c5a2410a2d7861d3c4f07f039eb8c471741cfa.tar.bz2
property_service: address comments from previous review.
Address post-submit comments from 694636142113d91c2b9585ad28e143d4ff001584 Bug: 10733330 Change-Id: I7c652f7ef0379536df48b9478a2362f1bfd252fe
Diffstat (limited to 'init')
-rw-r--r--init/property_service.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/init/property_service.c b/init/property_service.c
index c370769..1b9327c 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -281,7 +281,6 @@ static void write_persistent_property(const char *name, const char *value)
static bool is_legal_property_name(const char* name, size_t namelen)
{
size_t i;
- bool previous_was_dot = false;
if (namelen >= PROP_NAME_MAX) return false;
if (namelen < 1) return false;
if (name[0] == '.') return false;
@@ -291,11 +290,10 @@ static bool is_legal_property_name(const char* name, size_t namelen)
/* Don't allow ".." to appear in a property name */
for (i = 0; i < namelen; i++) {
if (name[i] == '.') {
- if (previous_was_dot == true) return false;
- previous_was_dot = true;
+ // i=0 is guaranteed to never have a dot. See above.
+ if (name[i-1] == '.') return false;
continue;
}
- previous_was_dot = false;
if (name[i] == '_' || name[i] == '-') continue;
if (name[i] >= 'a' && name[i] <= 'z') continue;
if (name[i] >= 'A' && name[i] <= 'Z') continue;