diff options
author | Martin Thomson <mt@lowentropy.net> | 2020-05-22 03:26:20 +0000 |
---|---|---|
committer | Martin Thomson <mt@lowentropy.net> | 2020-05-22 03:26:20 +0000 |
commit | 6bfb610be4ffc1db0f0dafa9c67c1b6743b429ad (patch) | |
tree | ac48900cf478e94705473656efc8ebc23a12cde4 | |
parent | 062f3deb5d6904839c27c9aaa3a8addd4e2fa482 (diff) | |
download | nss-hg-6bfb610be4ffc1db0f0dafa9c67c1b6743b429ad.tar.gz |
Bug 1640041 - Don't memcpy nothing, r=jcj
Depends on D76421
Differential Revision: https://phabricator.services.mozilla.com/D76422
-rw-r--r-- | lib/ssl/sslencode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ssl/sslencode.c b/lib/ssl/sslencode.c index e59e758ff..d07b544ab 100644 --- a/lib/ssl/sslencode.c +++ b/lib/ssl/sslencode.c @@ -64,7 +64,10 @@ sslBuffer_Append(sslBuffer *b, const void *data, unsigned int len) if (rv != SECSuccess) { return SECFailure; /* Code already set. */ } - PORT_Memcpy(SSL_BUFFER_NEXT(b), data, len); + if (len > 0) { + PORT_Assert(data); + PORT_Memcpy(SSL_BUFFER_NEXT(b), data, len); + } b->len += len; return SECSuccess; } |