Source-Changes-HG archive

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

[src/trunk]: src/crypto/dist/kame/libipsec realloc error check failure; Greg ...



details:   https://anonhg.NetBSD.org/src/rev/d55aad3fc6c6
branches:  trunk
changeset: 552820:d55aad3fc6c6
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Oct 03 21:53:32 2003 +0000

description:
realloc error check failure; Greg Troxel, sync w/kame

diffstat:

 crypto/dist/kame/libipsec/policy_parse.y |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r a8459f081ac3 -r d55aad3fc6c6 crypto/dist/kame/libipsec/policy_parse.y
--- a/crypto/dist/kame/libipsec/policy_parse.y  Fri Oct 03 21:53:08 2003 +0000
+++ b/crypto/dist/kame/libipsec/policy_parse.y  Fri Oct 03 21:53:32 2003 +0000
@@ -293,13 +293,13 @@
 {
        struct sadb_x_policy *p;
 
-       tlen = sizeof(struct sadb_x_policy);
-
        pbuf = malloc(tlen);
        if (pbuf == NULL) {
                __ipsec_errcode = EIPSEC_NO_BUFS;
                return -1;
        }
+       tlen = sizeof(struct sadb_x_policy);
+
        memset(pbuf, 0, tlen);
        p = (struct sadb_x_policy *)pbuf;
        p->sadb_x_policy_len = 0;       /* must update later */
@@ -327,7 +327,7 @@
                + (dst ? dst->sa_len : 0);
 
        n = realloc(pbuf, tlen + reqlen);
-       if (pbuf == NULL) {
+       if (n == NULL) {
                __ipsec_errcode = EIPSEC_NO_BUFS;
                return -1;
        }



Home | Main Index | Thread Index | Old Index