Source-Changes-HG archive

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

[src/netbsd-1-6]: src/crypto/dist/kame/libipsec Pull up revision 1.3 via patc...



details:   https://anonhg.NetBSD.org/src/rev/d5d2b1c19f91
branches:  netbsd-1-6
changeset: 530816:d5d2b1c19f91
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Oct 05 09:14:12 2003 +0000

description:
Pull up revision 1.3 via patch (requested by itojun in ticket #1507):
realloc error check failure; Greg Troxel, sync w/kame

diffstat:

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

diffs (36 lines):

diff -r 4bb58ce03523 -r d5d2b1c19f91 crypto/dist/kame/libipsec/policy_parse.y
--- a/crypto/dist/kame/libipsec/policy_parse.y  Sun Oct 05 09:10:05 2003 +0000
+++ b/crypto/dist/kame/libipsec/policy_parse.y  Sun Oct 05 09:14:12 2003 +0000
@@ -292,13 +292,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);
+
        p = (struct sadb_x_policy *)pbuf;
        p->sadb_x_policy_len = 0;       /* must update later */
        p->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
@@ -321,13 +321,13 @@
        reqlen = sizeof(*p)
                + (src ? src->sa_len : 0)
                + (dst ? dst->sa_len : 0);
-       tlen += reqlen;         /* increment to total length */
 
-       pbuf = realloc(pbuf, tlen);
-       if (pbuf == NULL) {
+       pbuf = realloc(pbuf, tlen + reqlen);
+       if (n == NULL) {
                __ipsec_errcode = EIPSEC_NO_BUFS;
                return -1;
        }
+       tlen += reqlen;         /* increment to total length */
        p = (struct sadb_x_ipsecrequest *)&pbuf[offset];
        p->sadb_x_ipsecrequest_len = reqlen;
        p->sadb_x_ipsecrequest_proto = p_protocol;



Home | Main Index | Thread Index | Old Index