diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-04-21 16:50:23 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-04-21 16:50:23 +0200 |
commit | 7aebca65f569ceb5fd8a12bef5fa6b58f277683d (patch) | |
tree | d24596b0445d3a21ca5db4af480aa6e71bc74ae8 /staging | |
parent | dce80974dcd2114ebb4a3ed3060d4d636cbb9d1d (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>
Diffstat (limited to 'staging')
-rw-r--r-- | staging/tools.c | 5 |
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" |