瀏覽代碼

main.c: fix strncat call to prevent buffer overflow

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf 11 年之前
父節點
當前提交
91f7daa9ed
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/main.c

+ 1 - 1
src/main.c

@@ -505,7 +505,7 @@ static void set_absolute_path(char *options[], const char *option_name,
         }
 
         strncat(path, "/", sizeof(path) - 1);
-        strncat(path, option_value, sizeof(path) - 1);
+        strncat(path, option_value, sizeof(path) - strlen(path) - 1);
 
         /* Absolutize the path, and set the option */
         IGNORE_UNUSED_RESULT(abs_path(path, abs, sizeof(abs)));