From: Arran Cudbard-Bell Date: Thu, 25 May 2017 20:28:07 +0000 (-0400) Subject: Fix potential buffer overrun? X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=423a2a09a8561f8542ecbb39ce5dd60985db8512;p=thirdparty%2Ffreeradius-server.git Fix potential buffer overrun? --- diff --git a/src/modules/proto_tacacs/tacacs.c b/src/modules/proto_tacacs/tacacs.c index 0684a7774e1..493c29ebc9e 100644 --- a/src/modules/proto_tacacs/tacacs.c +++ b/src/modules/proto_tacacs/tacacs.c @@ -722,7 +722,12 @@ int tacacs_read_packet(RADIUS_PACKET * const packet, char const * const secret) packet->data_len = packet_len; packet->partial = sizeof(tacacs_packet_hdr_t); - memcpy(packet->data, packet->vector, sizeof(tacacs_packet_hdr_t)); + + if (sizeof(packet->vector) > sizeof(tacacs_packet_hdr_t)) { + memcpy(packet->data, packet->vector, sizeof(tacacs_packet_hdr_t)); + } else { + memcpy(packet->data, packet->vector, sizeof(packet->vector)); + } } /*