baboom09 / sma-bluetooth

Automatically exported from code.google.com/p/sma-bluetooth
0 stars 0 forks source link

Aborted (core dumped) #134

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Get the latest release (currently 3b8df63532b4) & compile it.
2. Take any config file or copy the default one: cp ./smatool.conf.new 
./smatool.conf
3. Run ./smatool

What is the expected output? What do you see instead?
The program crashes with an "Aborted (core dumped)" message.

What version of the product are you using? On what operating system?
The latest: 3b8df63532b4, on ubuntu 14.04.1 64bits.

Please provide any additional information below.
================================================
After adding the -g option to gcc to get degugging info, gdb backtrace:

Reading symbols from smatool...done.
[New LWP 18989]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./smatool -d'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007ff751ebcf89 in __GI_raise (sig=sig@entry=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ff751ebcf89 in __GI_raise (sig=sig@entry=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ff751ec0398 in __GI_abort () at abort.c:89
#2  0x00007ff751efa1e4 in __libc_message (do_abort=do_abort@entry=2, 
fmt=fmt@entry=0x7ff7520064b5 "*** %s ***: %s terminated\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ff751f91bac in __GI___fortify_fail (msg=<optimised out>, 
msg@entry=0x7ff75200644c "buffer overflow detected")
    at fortify_fail.c:37
#4  0x00007ff751f90a70 in __GI___chk_fail () at chk_fail.c:28
#5  0x0000000000406e37 in strcpy (__src=0x7fff74d70d88 "Line Voltage Phase 
1Volts", __dest=<optimised out>)
    at /usr/include/x86_64-linux-gnu/bits/string3.h:104
#6  InitReturnKeys (conf=conf@entry=0x7fff74d71840, returnkeylist=0x7d42a0, 
returnkeylist@entry=0x0, 
    num_return_keys=num_return_keys@entry=0x7fff74d710ac) at smatool.c:855
#7  0x0000000000401ee8 in main (argc=2, argv=0x7fff74d72458) at smatool.c:1468
(gdb) 

The line 855 in smatool.c is:
strcpy( (returnkeylist+(*num_return_keys))->description, tmp.description );

The problem does not occur with older version such as 68:259753f695bb

I'm not a C programmer, so it's a bit difficult to me to figure out what's 
wrong. Thanks!

Original issue reported on code.google.com by francois...@gmail.com on 31 Aug 2014 at 11:48

GoogleCodeExporter commented 8 years ago
In GDB:

#6  InitReturnKeys (conf=conf@entry=0x7fffffffd600, returnkeylist=0x6102a0, 
returnkeylist@entry=0x0, 
    num_return_keys=num_return_keys@entry=0x7fffffffce6c) at smatool.c:855
855                                 strcpy( 
(returnkeylist+(*num_return_keys))->description, tmp.description );
(gdb) print tmp.description
$1 = "Line Voltage Phase 1"

Original comment by francois...@gmail.com on 31 Aug 2014 at 11:54