GNS3 / ubridge

Bridge for UDP tunnels, Ethernet, TAP and VMnet interfaces.
GNU General Public License v3.0
115 stars 46 forks source link

null pointer on function 'pcap_capture_packet #90

Open suzakuwcx opened 7 months ago

suzakuwcx commented 7 months ago

Host: archlinux ubridge version: v0.9.18 gns3-server version: 2.2.46-1

image

Here is the core, but I cannot reproduct

(gdb) file ../
.circleci/    .gitignore    LICENSE       Makefile      README.rst    appveyor.yml  src/          ubridge       
(gdb) file ../ubridge 
Load new symbol table from "../ubridge"? (y or n) y
Reading symbols from ../ubridge...
(gdb) bt
#0  0x000078bc15c134a6 in fflush () from /usr/lib/libc.so.6
#1  0x000078bc15daaace in pcap_dump_flush () from /usr/lib/libpcap.so.1
#2  0x000061215cbb663b in pcap_capture_packet (capture=0x78bc10004c90, pkt=pkt@entry=0x78bc14f4fdc0, len=len@entry=1494) at src/pcap_capture.c:101
#3  0x000061215cbb3711 in bridge_nios (rx_nio=0x78bc10004de0, tx_nio=0x78bc10004cd0, bridge=bridge@entry=0x78bc10004c40) at src/ubridge.c:104
#4  0x000061215cbb38f9 in destination_nio_listener (data=0x78bc10004c40) at src/ubridge.c:154
#5  0x000078bc15c2855a in ?? () from /usr/lib/libc.so.6
#6  0x000078bc15ca5a3c in ?? () from /usr/lib/libc.so.6
(gdb) up
#1  0x000078bc15daaace in pcap_dump_flush () from /usr/lib/libpcap.so.1
(gdb) up
#2  0x000061215cbb663b in pcap_capture_packet (capture=0x78bc10004c90, pkt=pkt@entry=0x78bc14f4fdc0, len=len@entry=1494) at src/pcap_capture.c:101
101           pcap_dump_flush(capture->dumper);
(gdb) up
#3  0x000061215cbb3711 in bridge_nios (rx_nio=0x78bc10004de0, tx_nio=0x78bc10004cd0, bridge=bridge@entry=0x78bc10004c40) at src/ubridge.c:104
104         pcap_capture_packet(bridge->capture, pkt, bytes_received);
(gdb) up
#4  0x000061215cbb38f9 in destination_nio_listener (data=0x78bc10004c40) at src/ubridge.c:154
154           if (bridge_nios(bridge->destination_nio, bridge->source_nio, bridge) == -1) {
(gdb) p bridge
$1 = (bridge_t *) 0x78bc10004c40
(gdb) p bridge->destination_nio 
$2 = (nio_t *) 0x78bc10004de0
(gdb) p bridge
$3 = (bridge_t *) 0x78bc10004c40
(gdb) down
#3  0x000061215cbb3711 in bridge_nios (rx_nio=0x78bc10004de0, tx_nio=0x78bc10004cd0, bridge=bridge@entry=0x78bc10004c40) at src/ubridge.c:104
104         pcap_capture_packet(bridge->capture, pkt, bytes_received);
(gdb) p bridge->capture 
$4 = (pcap_capture_t *) 0x0
(gdb) p pk
pkey_alloc     pkey_free      pkey_get       pkey_mprotect  pkey_set       pkt            
(gdb) p pkt 
$5 = "\354A\030\r\352D$K\376\316\311x\b\000E\000\005\310b\000\000\000@\021\272\346\300\250\001p=\220X\226&&\227z\005\264^\004\004\000\000\000\346N\027\337}(\005\000\000\000\000\000\310\374\002\237\225V\225,P\361I/P\026B~hG#\242{\222s+\231\363\260\a\256S\347\205\330\334\032d\027\343\302ð\313(H2\2206۽p\377\335r\221\254\372S\366\350\020\211\376J\261_\251\302E\264\342Е~\vK_\250ݛ\270T\265\253\313yN\254\255\017\336\a\230\023T\320Y\361\373k\3737\216\246\227*\311j\360y\270M\260\nM\2119\241\316\032鍼\027\275\035\027\366\240\322\a\v*\232\250]mRĮ\332?v0D\265f\267\300\246"...
(gdb) p bytes_received 
$6 = 1494
(gdb) 

So maybe a NULL pointer need to be judge at file 'src/ubridge.c:104' ?

 pcap_capture_packet(bridge->capture, pkt, bytes_received);