From 637e3376a03986ec59f67d4b0831fa7b35f4ac3f Mon Sep 17 00:00:00 2001 From: Ed Gonzalez Date: Thu, 5 Mar 2015 16:32:37 -0600 Subject: [PATCH] CID12076 - Out of bounds read. Fix inproper string allocation --- DSP_API/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DSP_API/main.c b/DSP_API/main.c index 07b1611..37d3b1f 100644 --- a/DSP_API/main.c +++ b/DSP_API/main.c @@ -154,7 +154,7 @@ int main( int argc, char * argv[]) safe_free( restrict_ip ); restrict_ip = NULL; } - restrict_ip = safe_malloc(strlen(argv[i])); + restrict_ip = safe_malloc(strlen(argv[i])+1); strncpy(restrict_ip, argv[i]+strlen(restrict_ip_param), strlen(argv[i])); output("Restrict IP = '%s'\n", restrict_ip); } else if ( strncmp(argv[i], config_path_param ,strlen(config_path_param)) == 0 ) { @@ -163,7 +163,7 @@ int main( int argc, char * argv[]) safe_free( cfg_path ) ; cfg_path = NULL; } - cfg_path = safe_malloc(strlen(argv[i])); + cfg_path = safe_malloc(strlen(argv[i])+1); strncpy(cfg_path, argv[i] + strlen(config_path_param), strlen(argv[i])); output("Config Path = '%s'\n", cfg_path); } else {