]> granicus.if.org Git - openssl/commitdiff
Sanity check DES_enc_write buffer length
authorMatt Caswell <matt@openssl.org>
Mon, 27 Apr 2015 10:04:56 +0000 (11:04 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 30 Apr 2015 22:12:39 +0000 (23:12 +0100)
Add a sanity check to DES_enc_write to ensure the buffer length provided
is not negative. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot
Oberoi (Int3 Solutions) for reporting this issue.

Reviewed-by: Andy Polyakov <appro@openssl.org>
crypto/des/enc_writ.c

index 55cc7fcb41011865748f9145e73aebee25b8bec1..9ea7c5a503c8c67356f6c6027a15739cb2e94e3e 100644 (file)
@@ -96,6 +96,9 @@ int DES_enc_write(int fd, const void *_buf, int len,
     const unsigned char *cp;
     static int start = 1;
 
+    if (len < 0)
+        return -1;
+
     if (outbuf == NULL) {
         outbuf = OPENSSL_malloc(BSIZE + HDRSIZE);
         if (outbuf == NULL)