Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > 80fa5e1138cb07f5b1e33462a61ed188 > files > 27

nss-3.21.0-6.el5_11.src.rpm

diff --git a/lib/freebl/gcm.c b/lib/freebl/gcm.c
--- a/lib/freebl/gcm.c
+++ b/lib/freebl/gcm.c
@@ -448,17 +448,19 @@ gcmHash_Update(gcmHashContext *ghash, co
     SECStatus rv;
 
     ghash->cLen += (len*PR_BITS_PER_BYTE);
 
     /* first deal with the current buffer of data. Try to fill it out so
      * we can hash it */
     if (ghash->bufLen) {
 	unsigned int needed = PR_MIN(len, blocksize - ghash->bufLen);
-	PORT_Memcpy(ghash->buffer+ghash->bufLen, buf, needed);
+	if (needed != 0) {
+	    PORT_Memcpy(ghash->buffer+ghash->bufLen, buf, needed);
+	}
 	buf += needed;
 	len -= needed;
 	ghash->bufLen += needed;
 	if (len == 0) {
 	    /* didn't add enough to hash the data, nothing more do do */
 	    return SECSuccess;
 	}
 	PORT_Assert(ghash->bufLen == blocksize);
@@ -809,17 +811,17 @@ GCM_DecryptUpdate(GCMContext *gcm, unsig
     unsigned char tag[MAX_BLOCK_SIZE];
     const unsigned char *intag;
     unsigned int len;
 
     tagBytes = (gcm->tagBits + (PR_BITS_PER_BYTE-1)) / PR_BITS_PER_BYTE;
 
     /* get the authentication block */
     if (inlen < tagBytes) {
-	PORT_SetError(SEC_ERROR_INVALID_ARGS);
+	PORT_SetError(SEC_ERROR_INPUT_LEN);
 	return SECFailure;
     }
 
     inlen -= tagBytes;
     intag = inbuf + inlen;
 
     /* verify the block */
     rv = gcmHash_Update(&gcm->ghash_context, inbuf, inlen, blocksize);