summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-04-21 16:50:23 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-04-21 16:50:23 +0200
commit7aebca65f569ceb5fd8a12bef5fa6b58f277683d (patch)
treed24596b0445d3a21ca5db4af480aa6e71bc74ae8
parentdce80974dcd2114ebb4a3ed3060d4d636cbb9d1d (diff)
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 <tklauser@distanz.ch>
-rw-r--r--staging/tools.c5
1 files 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"