From 98466f59d258d2079755d2a1808cd34631d9f230 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Mon, 10 Dec 2012 13:29:32 +0100 Subject: l2tp: Fix allocation checking when adding octets AVP l2tp_packet_add_octets() performs a malloc on the "octets" field of the L2TP attribute, but checks the "string" field for allocation failure. Though these fields should be equivalent in this case, the "octets" field should be logically checked instead of "string". Signed-off-by: Guillaume Nault --- accel-pppd/ctrl/l2tp/packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index 70d8d5d9..b1ae5d58 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -482,7 +482,7 @@ int l2tp_packet_add_octets(struct l2tp_packet_t *pack, int id, const uint8_t *va attr->length = size; attr->val.octets = _malloc(size); - if (!attr->val.string) { + if (!attr->val.octets) { log_emerg("l2tp: out of memory\n"); mempool_free(attr); return -1; -- cgit v1.2.3