From f43a3052cb3eb0bb87ea81f15e4a02487a5ed8ec Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 11 Jan 2014 10:17:13 +0200 Subject: Ensure gaslist is NULL terminated If buffer copying is restricted by the buffer size in strncpy or snprintf, the copied string is not NULL terminated. Add one to the end just to make sure. Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- statistics.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/statistics.c b/statistics.c index 6a6d177f4..fbb739791 100644 --- a/statistics.c +++ b/statistics.c @@ -365,5 +365,7 @@ char *get_gaslist(struct dive *dive) } if (*buf == '\0') strncpy(buf, translate("gettextFromC","air"), MAXBUF); + + buf[MAXBUF - 1] = '\0'; return buf; } -- cgit v1.2.3-70-g09d2