diff options
author | Nick White <git@njw.me.uk> | 2012-03-29 11:37:03 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2012-03-29 11:37:03 +0100 |
commit | 4bfac013e70271e8273e41d2fa609d48db83a3b3 (patch) | |
tree | f91773fcaaa1a50696e56a03ee579dfb26834c2c /getbnbook.c | |
parent | 35e12cdf263178f62ef2fd7b9b2f3e5a9ad44fcf (diff) |
Use strncpy and strncat more safely
Diffstat (limited to 'getbnbook.c')
-rw-r--r-- | getbnbook.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/getbnbook.c b/getbnbook.c index 3b044d6..d228069 100644 --- a/getbnbook.c +++ b/getbnbook.c @@ -106,7 +106,8 @@ int main(int argc, char *argv[]) return 1; } - strncpy(bookid, argv[argc-1], STRMAX); + strncpy(bookid, argv[argc-1], STRMAX-1); + bookid[STRMAX-1] = '\0'; bookdir = argv[argc-1]; /* get cookie */ |