mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
util, nb_dns: fix off-by-one bugs in strncpy() calls
Fortunately, these bugs had no effect because the following lines overwrote the last character with a null byte.
This commit is contained in:
parent
aacf84e552
commit
32bb019e3a
3 changed files with 3 additions and 3 deletions
|
@ -512,7 +512,7 @@ inline void* safe_malloc(size_t size)
|
|||
|
||||
inline char* safe_strncpy(char* dest, const char* src, size_t n)
|
||||
{
|
||||
char* result = strncpy(dest, src, n);
|
||||
char* result = strncpy(dest, src, n-1);
|
||||
dest[n-1] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue