Code

frontend/scanner: Pass the right size to strncat.
authorSebastian Harl <sh@tokkee.org>
Fri, 2 Jan 2015 11:56:14 +0000 (12:56 +0100)
committerSebastian Harl <sh@tokkee.org>
Fri, 2 Jan 2015 11:56:14 +0000 (12:56 +0100)
Thanks to clang for identifying this :-)

src/frontend/scanner.l

index 65ec9edceb79ff73769e03e37046123971d9b73f..6781122c3c2b830547b66a0fe82a7e57b3f15cb4 100644 (file)
@@ -237,7 +237,7 @@ time                ([0-9]{1,2}:[0-9]{1,2}(:[0-9]{1,2}(\.[0-9]{1,9})?)?)
                assert(tmp);
                tmp = strchr(tmp + 1, ':');
                if (! tmp)
-                       strncat(time, ":00", sizeof(time));
+                       strncat(time, ":00", sizeof(time) - strlen(time) - 1);
 
                if (! strptime(time, "%H:%M:%S", &tm)) {
                        char errmsg[1024];