diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-01-11 10:17:13 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-11 16:46:31 +0700 |
commit | f43a3052cb3eb0bb87ea81f15e4a02487a5ed8ec (patch) | |
tree | 375548a8854c85a736b3936f783bbb1125aaa74f /statistics.c | |
parent | 9fca37acecdc0e8a622f7618b205383348611dac (diff) | |
download | subsurface-f43a3052cb3eb0bb87ea81f15e4a02487a5ed8ec.tar.gz |
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 <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r-- | statistics.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |