Krumme, Chris wrote:
Hello Anthony,

Cool patch series.

Thanks.

+        cmd = ptr;
+        arg = strchr(cmd, ' ');
+        if (arg == NULL) {
+            arg = strchr(cmd, '\t');
+        }
+
+        if (arg == NULL) {
+            fprintf(stderr, "Invalid config line:\n  %s\n", line);
+            fclose(f);
+            errno = EINVAL;
+            return -1;
+        }
+
+        *arg = 0;

No check is made for arg being in bounds.

I don't get it. arg is either going to be NULL (no ' ' or '\t' found in the string) or it will point to the first ' ' or '\t' in the string. It will always be in bound in this second case and the first case is handled by the if().

Regards,

Anthony Liguori


Reply via email to