mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
9fca37acec
commit
f43a3052cb
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue