summaryrefslogtreecommitdiff
path: root/getgbook.c
diff options
context:
space:
mode:
Diffstat (limited to 'getgbook.c')
-rw-r--r--getgbook.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/getgbook.c b/getgbook.c
index 67bd1ca..660a1f6 100644
--- a/getgbook.c
+++ b/getgbook.c
@@ -187,7 +187,8 @@ int main(int argc, char *argv[])
free(tmp);
}
- strncpy(bookid, argv[argc-1], STRMAX);
+ strncpy(bookid, argv[argc-1], STRMAX-1);
+ bookid[STRMAX-1] = '\0';
bookdir = argv[argc-1];
pages = malloc(sizeof(*pages) * MAXPAGES);