elm_prefs.c: make the string null terminated.
authorDaniel Juyung Seo <seojuyung2@gmail.com>
Sun, 11 Aug 2013 08:21:31 +0000 (17:21 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Sun, 11 Aug 2013 08:21:31 +0000 (17:21 +0900)
This fixes coverity CID 1046593 : Buffer not null terminated (BUFFER_SIZE_WARNING).

src/lib/elm_prefs.c

index f2b8b3f..43e8b7e 100644 (file)
@@ -333,7 +333,8 @@ _elm_prefs_item_node_by_name(Elm_Prefs_Smart_Data *sd,
    char *token;
    char *aux = buf;
 
-   strncpy(buf, name, PATH_MAX);
+   strncpy(buf, name, PATH_MAX - 1);
+   buf[PATH_MAX - 1] = '\0';
 
    token = strsep(&aux, ":");