]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Fix a regression with SA-15:24 patch that prevented NIS from
authordelphij <delphij@FreeBSD.org>
Fri, 2 Oct 2015 16:35:41 +0000 (16:35 +0000)
committerdelphij <delphij@FreeBSD.org>
Fri, 2 Oct 2015 16:35:41 +0000 (16:35 +0000)
working.

usr.sbin/rpcbind/rpcb_svc_com.c

index a88f61947f9666cda846d7da5f95201aed501f96..326224a6062ee8a3eaa53b64b194e806ed75256b 100644 (file)
@@ -1052,12 +1052,15 @@ static bool_t
 netbuf_copybuf(struct netbuf *dst, const struct netbuf *src)
 {
 
-       assert(dst->buf == NULL);
+       if (dst->len != src->len || dst->buf == NULL) {
+               if (dst->buf != NULL)
+                       free(dst->buf);
+               if ((dst->buf = malloc(src->len)) == NULL)
+                       return (FALSE);
 
-       if ((dst->buf = malloc(src->len)) == NULL)
-               return (FALSE);
+               dst->maxlen = dst->len = src->len;
+       }
 
-       dst->maxlen = dst->len = src->len;
        memcpy(dst->buf, src->buf, src->len);
        return (TRUE);
 }