summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-08-08 02:21:55 +0200
committerKay Sievers <kay.sievers@suse.de>2005-08-08 02:21:55 +0200
commit13d11705bf0117365afc3f9210f4d568a2baa69c (patch)
treeed8d587b482e42072f51190bc8f8edc13e87dba5 /udev_rules_parse.c
parent738428b4499211247dafa394805ecaa2cb313f03 (diff)
switch some strlcpy's to memcpy
strlcpy counts the sourec string lengt and is therefore not suitable to copy a defined length of characters from one string to another. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index be0757374e..4580a779c6 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -89,7 +89,7 @@ static int get_key(char **line, char **key, enum key_operation *operation, char
char *temp;
linepos = *line;
- if (!linepos)
+ if (linepos == NULL && linepos[0] == '\0')
return -1;
/* skip whitespace */
@@ -97,7 +97,10 @@ static int get_key(char **line, char **key, enum key_operation *operation, char
linepos++;
/* get the key */
+ if (linepos[0] == '\0')
+ return -1;
*key = linepos;
+
while (1) {
linepos++;
if (linepos[0] == '\0')
@@ -120,6 +123,8 @@ static int get_key(char **line, char **key, enum key_operation *operation, char
/* skip whitespace after key */
while (isspace(linepos[0]))
linepos++;
+ if (linepos[0] == '\0')
+ return -1;
/* get operation type */
if (linepos[0] == '=' && linepos[1] == '=') {
@@ -152,6 +157,8 @@ static int get_key(char **line, char **key, enum key_operation *operation, char
/* skip whitespace after operator */
while (isspace(linepos[0]))
linepos++;
+ if (linepos[0] == '\0')
+ return -1;
/* get the value*/
if (linepos[0] == '"')
@@ -634,6 +641,7 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names)
list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) {
parse_file(rules, name_loop->name);
list_del(&name_loop->node);
+ free(name_loop);
}
}