asdfuser pushed a commit to branch master.

commit 3e5bd813d3978558c5e164c7819b18f51e810ec2
Author: Daniel Willmann <[email protected]>
Date:   Mon Aug 12 18:30:24 2013 +0100

    embryo: Fix a potential buffer overflow (klocwork id 321)
    
    Signed-off-by: Daniel Willmann <[email protected]>
---
 src/bin/embryo/embryo_cc_sc1.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index 4c49a60..0340d35 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -679,10 +679,15 @@ setconfig(char *root)
          {
             strcat(path, "include");
          }
-       len = strlen(path);
-       path[len] = DIRSEP_CHAR;
-       path[len + 1] = '\0';
-       insert_path(path);
+
+        /* Make sure we have enough space for the trailing DIRSEP_CHAR */
+        if (strlen(path) == sizeof(path) - 1)
+          {
+             len = strlen(path);
+             path[len] = DIRSEP_CHAR;
+             path[len + 1] = '\0';
+             insert_path(path);
+          }
      }                         /* if */
 }
 

-- 

------------------------------------------------------------------------------
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