Source-Changes-HG archive

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

[src/trunk]: src/lib/libipsec realloc error check failure; Greg Troxel, sync ...



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

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

diffstat:

 lib/libipsec/policy_parse.y |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r add36015adbc -r a8459f081ac3 lib/libipsec/policy_parse.y
--- a/lib/libipsec/policy_parse.y       Fri Oct 03 21:29:16 2003 +0000
+++ b/lib/libipsec/policy_parse.y       Fri Oct 03 21:53:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: policy_parse.y,v 1.11 2003/10/02 19:38:59 itojun Exp $ */
+/*     $NetBSD: policy_parse.y,v 1.12 2003/10/03 21:53:08 itojun Exp $ */
 /*     $KAME: policy_parse.y,v 1.15 2003/10/02 19:37:49 itojun Exp $   */
 
 /*
@@ -294,13 +294,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 */
@@ -328,7 +328,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