[dpdk-stable] [PATCH v2] app/procinfo: fix strncpy count issue
    Radu Nicolau 
    radu.nicolau at intel.com
       
    Tue Feb 20 14:00:21 CET 2018
    
    
  
Change strncpy count parameter to MAX_LONG_OPT_SZ-1 to avoid
overwriting the last NULL character and for consistency.
Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id")
Coverity issue: 143252
Cc: stable at dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau at intel.com>
---
v2: corrected coverity issue id
 app/proc_info/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/proc_info/main.c b/app/proc_info/main.c
index 2f53e3c..5f0b745 100644
--- a/app/proc_info/main.c
+++ b/app/proc_info/main.c
@@ -159,7 +159,7 @@ proc_info_preparse_args(int argc, char **argv)
 				proc_info_usage(prgname);
 				return -1;
 			}
-			strncpy(host_id, argv[i+1], sizeof(host_id));
+			strncpy(host_id, argv[i+1], MAX_LONG_OPT_SZ-1);
 		}
 	}
 
-- 
2.7.5
    
    
More information about the stable
mailing list