File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1237,14 +1237,14 @@ static void *pppd_write(void *arg)
12371237 if (tunnel -> config -> tun ) {
12381238 void * pkt_type = pkt_data (packet );
12391239
1240- len = packet -> len ;
1240+ len = packet -> len - 2 ;
12411241 switch (ntohs (* (uint16_t * )pkt_type )) {
12421242 case PPP_LCP :
1243- lcp_packet (tunnel , pkt_data (packet ) + 2 , len - 2 );
1243+ lcp_packet (tunnel , pkt_data (packet ) + 2 , len );
12441244 free (packet );
12451245 continue ;
12461246 case PPP_IPCP :
1247- ipcp_packet (tunnel , pkt_data (packet ) + 2 , len - 2 );
1247+ ipcp_packet (tunnel , pkt_data (packet ) + 2 , len );
12481248 free (packet );
12491249 continue ;
12501250 case PPP_IP :
@@ -1254,13 +1254,13 @@ static void *pppd_write(void *arg)
12541254 goto out_free_packet ;
12551255 }
12561256
1257- hdlc_buffer = malloc (packet -> len );
1257+ hdlc_buffer = malloc (len );
12581258 if (hdlc_buffer == NULL ) {
12591259 log_error ("malloc: %s\n" , strerror (errno ));
12601260 break ;
12611261 }
12621262
1263- memcpy (hdlc_buffer , pkt_data (packet ) + 2 , packet -> len - 2 );
1263+ memcpy (hdlc_buffer , pkt_data (packet ) + 2 , len );
12641264 } else {
12651265 size_t hdlc_bufsize = estimated_encoded_size (packet -> len );
12661266
You can’t perform that action at this time.
0 commit comments