今天一上班程序就出现个问题……
*** stack smashing detected ***: ./main terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xf5f008]
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x0)[0xf5efc0]
./main[0x804a0dc]
./main[0x804a0ee]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xe94b56]
./main[0x8048e51]
======= Memory map: ========
00313000-0032e000 r-xp 00000000 08:03 5496842 /lib/ld-2.10.1.so
0032e000-0032f000 r--p 0001a000 08:03 5496842 /lib/ld-2.10.1.so
0032f000-00330000 rw-p 0001b000 08:03 5496842 /lib/ld-2.10.1.so
005ee000-005ef000 r-xp 00000000 00:00 0 [vdso]
008a4000-008c0000 r-xp 00000000 08:03 5496838 /lib/libgcc_s.so.1
008c0000-008c1000 r--p 0001b000 08:03 5496838 /lib/libgcc_s.so.1
008c1000-008c2000 rw-p 0001c000 08:03 5496838 /lib/libgcc_s.so.1
00e7e000-00fbc000 r-xp 00000000 08:03 5513286 /lib/tls/i686/cmov/libc-2.10.1.so
00fbc000-00fbd000 ---p 0013e000 08:03 5513286 /lib/tls/i686/cmov/libc-2.10.1.so
00fbd000-00fbf000 r--p 0013e000 08:03 5513286 /lib/tls/i686/cmov/libc-2.10.1.so
00fbf000-00fc0000 rw-p 00140000 08:03 5513286 /lib/tls/i686/cmov/libc-2.10.1.so
00fc0000-00fc3000 rw-p 00000000 00:00 0
08048000-0804d000 r-xp 00000000 08:03 15409153 /home/xing/work/senhui/gprs/main
0804d000-0804e000 r--p 00004000 08:03 15409153 /home/xing/work/senhui/gprs/main
0804e000-0804f000 rw-p 00005000 08:03 15409153 /home/xing/work/senhui/gprs/main
08950000-08971000 rw-p 00000000 00:00 0 [heap]
b7816000-b7817000 rw-p 00000000 00:00 0
b782b000-b782e000 rw-p 00000000 00:00 0
bfd0f000-bfd24000 rw-p 00000000 00:00 0 [stack]
已放弃
检查了下发现自己的程序数组定义的太小了,溢出了……。
static void init_GPRS(void)
{
char buf[10];
memset(buf,0,sizeof(buf));
JZQ.IP.IPMain[0] = 59;
JZQ.IP.IPMain[1] = 61;
JZQ.IP.IPMain[2] = 166;
JZQ.IP.IPMain[3] = 99;
JZQ.IP.PortMain = 8888;
sprintf(buf,"%d.%d.%d.%d",JZQ.IP.IPMain[0],JZQ.IP.IPMain[1],JZQ.IP.IPMain[2],
JZQ.IP.IPMain[3]);
printf("IP:%s/nPORT:%d/n",buf,JZQ.IP.PortMain);
Class_IP = C_IPMain; //采用主站IP
}
把buf改大点就OK了。