seoz pushed a commit to branch master.

commit 67b7f28aee6f071487c9e29bba66e391a7a73994
Author: Daniel Juyung Seo <[email protected]>
Date:   Sun Aug 11 17:21:31 2013 +0900

    elm_prefs.c: make the string null terminated.
    
    This fixes coverity CID 1046593 : Buffer not null terminated 
(BUFFER_SIZE_WARNING).
---
 src/lib/elm_prefs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lib/elm_prefs.c b/src/lib/elm_prefs.c
index f2b8b3f..43e8b7e 100644
--- a/src/lib/elm_prefs.c
+++ b/src/lib/elm_prefs.c
@@ -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, ":");
 

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk

Reply via email to