assert non-NULL ptrs before calling mem funcs
The definitions of memcpy(), memmove(), and memset() state that the behaviour is undefined if any of the pointer arguments are NULL, and some compilers are known to make use of this to optimise away existing NULL checks in the source. Change-Id: I489bc256e3eac7ff41d91becb0b43aba73dbb3f9 Link: https://www.imperialviolet.org/2016/06/26/nonnull.html
This commit is contained in:

committed by
Jeffrey Altman

parent
d35c9b2d67
commit
190263bb7a
@@ -167,10 +167,13 @@ arcfour_mic_cksum_iov(krb5_context context,
|
||||
continue;
|
||||
}
|
||||
|
||||
memcpy(ptr + ofs,
|
||||
iov[i].buffer.value,
|
||||
iov[i].buffer.length);
|
||||
ofs += iov[i].buffer.length;
|
||||
if (iov[i].buffer.length > 0) {
|
||||
assert(iov[i].buffer.value != NULL);
|
||||
memcpy(ptr + ofs,
|
||||
iov[i].buffer.value,
|
||||
iov[i].buffer.length);
|
||||
ofs += iov[i].buffer.length;
|
||||
}
|
||||
}
|
||||
|
||||
if (padding) {
|
||||
|
Reference in New Issue
Block a user