diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-03-11 16:28:34 -0500 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-03-11 18:29:14 -0500 |
commit | 5e57b5fc621300427d3818f0723b8cd8d5e5ca6a (patch) | |
tree | 738345e0c3121f329266e8b8faaa88661e7cdb2e /isisd/isis_zebra.c | |
parent | e3f623be8b6556db9d70c2fc5d3c2b152f36dc1d (diff) | |
download | quagga-5e57b5fc621300427d3818f0723b8cd8d5e5ca6a.tar.bz2 quagga-5e57b5fc621300427d3818f0723b8cd8d5e5ca6a.tar.xz |
quagga: Remove double read of stream
The addition of a MIN(X,Y) with a stream_getc in the Y
causes a double read of the stream due to the way that
MIN is defined.
This fix removes a crash in all protocols.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'isisd/isis_zebra.c')
-rw-r--r-- | isisd/isis_zebra.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index a1a5bea7..4acaf8e8 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -529,6 +529,7 @@ isis_zebra_read_ipv4 (int command, struct zclient *zclient, struct prefix *p_generic = (struct prefix*)&p; unsigned long ifindex __attribute__ ((unused)); struct in_addr nexthop __attribute__ ((unused)); + unsigned char plength = 0; stream = zclient->ibuf; memset(&api, 0, sizeof(api)); @@ -541,7 +542,8 @@ isis_zebra_read_ipv4 (int command, struct zclient *zclient, api.message = stream_getc (stream); p.family = AF_INET; - p.prefixlen = MIN(IPV4_MAX_PREFIXLEN, stream_getc (stream)); + plength = stream_getc (stream); + p.prefixlen = MIN(IPV4_MAX_PREFIXLEN, plength); stream_get (&p.prefix, stream, PSIZE (p.prefixlen)); if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP)) |