]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix potential buffer overrun?
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 25 May 2017 20:28:07 +0000 (16:28 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 25 May 2017 20:28:07 +0000 (16:28 -0400)
src/modules/proto_tacacs/tacacs.c

index 0684a7774e176e30b67676125a5f40bf225cacf5..493c29ebc9e1eeebdb835fc3004600b8f9ba260f 100644 (file)
@@ -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));
+               }
        }
 
        /*