From 7aebca65f569ceb5fd8a12bef5fa6b58f277683d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 21 Apr 2015 16:50:23 +0200 Subject: mausezahn: Make sure '\0' is written after strncpy Make sure params is always NULL-terminated as strncpy() doesn't guarantee this. Closes #134 Signed-off-by: Tobias Klauser --- staging/tools.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/staging/tools.c b/staging/tools.c index 96f0bb7..be8eace 100644 --- a/staging/tools.c +++ b/staging/tools.c @@ -684,9 +684,10 @@ int get_mpls_params(char *p) tx.mpls_exp = 0; tx.mpls_ttl = 255; - + strncpy(params, p, 256); - + params[255] = '\0'; + if (strncmp(params,"help",4)==0) { fprintf(stderr,"\n" -- cgit v1.2.3-54-g00ecf