|
@@ -153,10 +153,16 @@ static int set_dhcp_packet_option ( struct dhcp_packet *dhcppkt,
|
153
|
153
|
memcpy ( &dhcphdr->siaddr, data, sizeof ( dhcphdr->siaddr ) );
|
154
|
154
|
return 0;
|
155
|
155
|
case DHCP_TFTP_SERVER_NAME:
|
156
|
|
- strncpy ( dhcphdr->sname, data, sizeof ( dhcphdr->sname ) );
|
|
156
|
+ memset ( dhcphdr->sname, 0, sizeof ( dhcphdr->sname ) );
|
|
157
|
+ if ( len > sizeof ( dhcphdr->sname ) )
|
|
158
|
+ len = sizeof ( dhcphdr->sname );
|
|
159
|
+ memcpy ( dhcphdr->sname, data, len );
|
157
|
160
|
return 0;
|
158
|
161
|
case DHCP_BOOTFILE_NAME:
|
159
|
|
- strncpy ( dhcphdr->file, data, sizeof ( dhcphdr->file ) );
|
|
162
|
+ memset ( dhcphdr->file, 0, sizeof ( dhcphdr->file ) );
|
|
163
|
+ if ( len > sizeof ( dhcphdr->file ) )
|
|
164
|
+ len = sizeof ( dhcphdr->file );
|
|
165
|
+ memcpy ( dhcphdr->file, data, len );
|
160
|
166
|
return 0;
|
161
|
167
|
default:
|
162
|
168
|
/* Continue processing as normal */
|