]> err.no Git - systemd/commitdiff
check line length after comment check and whitespace strip
authorHarald Hoyer <harald@redhat.com>
Tue, 11 Sep 2007 15:17:29 +0000 (17:17 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Tue, 11 Sep 2007 15:17:29 +0000 (17:17 +0200)
udev_config.c
udev_rules.c

index 3f226b9d7cd2f0e21a9ca3b1cdb56459dcbb37ff..2f2a69eb487a6fc1fc2e047df32ecc1bbee579ff 100644 (file)
@@ -111,11 +111,6 @@ static int parse_config_file(void)
                cur += count+1;
                lineno++;
 
-               if (count >= sizeof(line)) {
-                       err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno);
-                       continue;
-               }
-
                /* eat the whitespace */
                while ((count > 0) && isspace(bufline[0])) {
                        bufline++;
@@ -128,6 +123,11 @@ static int parse_config_file(void)
                if (bufline[0] == COMMENT_CHARACTER)
                        continue;
 
+               if (count >= sizeof(line)) {
+                       err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno);
+                       continue;
+               }
+
                memcpy(line, bufline, count);
                line[count] = '\0';
 
index dcd091485b8e74c433916941c5aabd9e000f8e73..3ec8477461e43fe61be68d2e4f2d24dedd9dc0bf 100644 (file)
@@ -349,11 +349,6 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu
                cur += count+1;
                lineno++;
 
-               if (count >= sizeof(line)) {
-                       err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno);
-                       continue;
-               }
-
                /* eat the whitespace */
                while ((count > 0) && isspace(bufline[0])) {
                        bufline++;
@@ -366,6 +361,11 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu
                if (bufline[0] == COMMENT_CHARACTER)
                        continue;
 
+               if (count >= sizeof(line)) {
+                       err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno);
+                       continue;
+               }
+
                memcpy(line, bufline, count);
                line[count] = '\0';