* In NETstring use memcpy to copy the string and guarantee NUL-termination manually
* strlcpy() is unsafe if we cannot trust the source string to be NUL-terminated (as strlcpy does "return strlen(src);") git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4242 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
6cd8e03773
commit
cf6ea01b4a
|
@ -357,7 +357,9 @@ BOOL NETstring(char *str, uint16_t maxlen)
|
|||
NetMsg.type, NetMsg.source, len, maxlen);
|
||||
len = maxlen;
|
||||
}
|
||||
strlcpy(str, store, len);
|
||||
memcpy(str, store, len);
|
||||
// Guarantee NUL-termination
|
||||
str[len - 1] = '\0';
|
||||
}
|
||||
|
||||
// Increment the size of the message
|
||||
|
|
Loading…
Reference in New Issue