Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/netsmb



>>> "Joerg Sonnenberger" <joerg%netbsd.org@localhost> wrote

> Module Name:  src
> Committed By: joerg
> Date:         Thu Feb 20 11:08:57 UTC 2014
> 
> Modified Files:
>       src/sys/netsmb: iconv.c
> 
> Log Message:
> Don't dereference NULL pointers.

I guess proper fix is to move NULL check in iconv_conv().

-- Takeshi Nakayama


Index: iconv.c
===================================================================
RCS file: /cvsroot/src/sys/netsmb/iconv.c,v
retrieving revision 1.12
diff -u -d -r1.12 iconv.c
--- iconv.c     16 Nov 2006 01:33:51 -0000      1.12
+++ iconv.c     20 Feb 2014 11:38:05 -0000
@@ -30,12 +30,12 @@
 iconv_conv(void *handle, const char **inbuf,
     size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 {
-       if (*inbytesleft > *outbytesleft)
-               return(E2BIG);
-
        if (inbuf == NULL)
                return(0); /* initial shift state */
 
+       if (*inbytesleft > *outbytesleft)
+               return(E2BIG);
+
        (void)memcpy(*outbuf, *inbuf, *inbytesleft);
 
        *outbytesleft -= *inbytesleft;


Home | Main Index | Thread Index | Old Index