edje_cc handle theoretical string overflow (not real) shhh coverity
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 11 Jul 2016 13:23:58 +0000 (22:23 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 11 Jul 2016 13:23:58 +0000 (22:23 +0900)
these strings are internal fixed strings so never bigger than buffer,.
but silence coverity to avoid noise. fixes CID 1355588 , 1355589

src/bin/edje/edje_cc_parse.c

index 4c860b5..ea0cc30 100644 (file)
@@ -216,7 +216,8 @@ new_object(void)
                   char buf[512] = { 0, };
                   char *end;
 
-                  strcpy(buf, id);
+                  strncpy(buf, id, sizeof(buf) - 1);
+                  buf[sizeof(buf) - 1] = 0;
                   end = strrchr(buf, '.');
                   if (end) end++;
                   else end = buf;
@@ -256,7 +257,8 @@ new_statement(void)
         char buf[512] = { 0, };
         char *end;
 
-        strcpy(buf, id);
+        strncpy(buf, id, sizeof(buf) - 1);
+        buf[sizeof(buf) - 1] = 0;
         end = strrchr(buf, '.');
         if (end) end++;
         else end = buf;