correct unsafe use of realloc().
This commit is contained in:
parent
d451ef2606
commit
27ed6671c7
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: policy_parse.y,v 1.10 2003/07/22 03:32:58 itojun Exp $ */
|
||||
/* $KAME: policy_parse.y,v 1.14 2003/06/27 03:39:20 itojun Exp $ */
|
||||
/* $NetBSD: policy_parse.y,v 1.11 2003/10/02 19:38:59 itojun Exp $ */
|
||||
/* $KAME: policy_parse.y,v 1.15 2003/10/02 19:37:49 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
|
||||
@ -321,17 +321,19 @@ set_x_request(src, dst)
|
||||
{
|
||||
struct sadb_x_ipsecrequest *p;
|
||||
int reqlen;
|
||||
caddr_t n;
|
||||
|
||||
reqlen = sizeof(*p)
|
||||
+ (src ? src->sa_len : 0)
|
||||
+ (dst ? dst->sa_len : 0);
|
||||
tlen += reqlen; /* increment to total length */
|
||||
|
||||
pbuf = realloc(pbuf, tlen);
|
||||
n = realloc(pbuf, tlen + reqlen);
|
||||
if (pbuf == NULL) {
|
||||
__ipsec_errcode = EIPSEC_NO_BUFS;
|
||||
return -1;
|
||||
}
|
||||
tlen += reqlen;
|
||||
pbuf = n;
|
||||
p = (struct sadb_x_ipsecrequest *)&pbuf[offset];
|
||||
p->sadb_x_ipsecrequest_len = reqlen;
|
||||
p->sadb_x_ipsecrequest_proto = p_protocol;
|
||||
|
Loading…
Reference in New Issue
Block a user