使用libpcap时出现分段错误

时间:2013-02-21 23:49:41

标签: c segmentation-fault valgrind libpcap

这是我的程序的Valgrind输出,我用它来解析.pcap个文件。

不幸的是,我可能不会在这里粘贴程序的来源...... 问题是,memcpy(...)我没有plugin_input_get_flow(...)来电 当我在没有valgrind的情况下运行程序时,它运行得很好。 这可能吗?它是否表明,我正在以错误的方式使用libpcap库

Invalid write of size 1
==18228==    at 0x4A08877: memcpy (mc_replace_strmem.c:587)
==18228==    by 0x5229E9A: plugin_input_get_flow (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x409EA0: sw_get_flow_thread (in /usr/bin/flowmonexp)
==18228==    by 0x363600673C: start_thread (in /lib64/libpthread-2.5.so)
==18228==    by 0x36354D3D1C: clone (in /lib64/libc-2.5.so)
==18228==  Address 0xc3d2d5f is 1 bytes before a block of size 568 alloc'd
==18228==    at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==18228==    by 0x3635461709: __fopen_internal (in /lib64/libc-2.5.so)
==18228==    by 0x3635C13A5C: pcap_open_offline (in /usr/lib64/libpcap.so.0.9.4)
==18228==    by 0x5229A3A: plugin_input_init (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x40974C: sw_init (in /usr/bin/flowmonexp)
==18228==    by 0x4115B5: main (in /usr/bin/flowmonexp)
==18228== 
==18228== Invalid write of size 1
==18228==    at 0x4A0887D: memcpy (mc_replace_strmem.c:587)
==18228==    by 0x5229E9A: plugin_input_get_flow (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x409EA0: sw_get_flow_thread (in /usr/bin/flowmonexp)
==18228==    by 0x363600673C: start_thread (in /lib64/libpthread-2.5.so)
==18228==    by 0x36354D3D1C: clone (in /lib64/libc-2.5.so)
==18228==  Address 0xc3d2d5e is 2 bytes before a block of size 568 alloc'd
==18228==    at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==18228==    by 0x3635461709: __fopen_internal (in /lib64/libc-2.5.so)
==18228==    by 0x3635C13A5C: pcap_open_offline (in /usr/lib64/libpcap.so.0.9.4)
==18228==    by 0x5229A3A: plugin_input_init (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x40974C: sw_init (in /usr/bin/flowmonexp)
==18228==    by 0x4115B5: main (in /usr/bin/flowmonexp)
==18228== 
==18228== Invalid write of size 1
==18228==    at 0x4A08884: memcpy (mc_replace_strmem.c:587)
==18228==    by 0x5229E9A: plugin_input_get_flow (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x409EA0: sw_get_flow_thread (in /usr/bin/flowmonexp)
==18228==    by 0x363600673C: start_thread (in /lib64/libpthread-2.5.so)
==18228==    by 0x36354D3D1C: clone (in /lib64/libc-2.5.so)
==18228==  Address 0xc3d2d5d is 3 bytes before a block of size 568 alloc'd
==18228==    at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==18228==    by 0x3635461709: __fopen_internal (in /lib64/libc-2.5.so)
==18228==    by 0x3635C13A5C: pcap_open_offline (in /usr/lib64/libpcap.so.0.9.4)
==18228==    by 0x5229A3A: plugin_input_init (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x40974C: sw_init (in /usr/bin/flowmonexp)
==18228==    by 0x4115B5: main (in /usr/bin/flowmonexp)
==18228== 
==18228== Invalid write of size 1
==18228==    at 0x4A0888F: memcpy (mc_replace_strmem.c:587)
==18228==    by 0x5229E9A: plugin_input_get_flow (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x409EA0: sw_get_flow_thread (in /usr/bin/flowmonexp)
==18228==    by 0x363600673C: start_thread (in /lib64/libpthread-2.5.so)
==18228==    by 0x36354D3D1C: clone (in /lib64/libc-2.5.so)
==18228==  Address 0xc3d2d5c is 4 bytes before a block of size 568 alloc'd
==18228==    at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==18228==    by 0x3635461709: __fopen_internal (in /lib64/libc-2.5.so)
==18228==    by 0x3635C13A5C: pcap_open_offline (in /usr/lib64/libpcap.so.0.9.4)
==18228==    by 0x5229A3A: plugin_input_init (in /home/flowmon/ipfix/flowmon-http-plugins-1.0/src/input-http/.libs/flowmon-input-http.so)
==18228==    by 0x40974C: sw_init (in /usr/bin/flowmonexp)
==18228==    by 0x4115B5: main (in /usr/bin/flowmonexp)

0 个答案:

没有答案