Issue #15 resolved

bgpdump -T aborts on Mac OS X Lion

Anonymous created an issue

bash-3.2$ ./bgpdump -T ... (snip) ... 0 =?= 0 (1) 99999 =?= 99999 (5) 4294967295 =?= 4294967295 (10) Abort trap: 6 =====

This is caused by a trivial bug in int2str() (in util.c). Only those who have array range check complain.

===== $ diff -c util.c.ORIG util.c util.c.ORIG 2010-10-21 18:48:11.000000000 +0900 --- util.c 2012-06-08 14:36:09.000000000 +0900 *** 112,118 **** { const int LEN = 11; char b[LEN]; ! int i = LEN; b[i--] = '\0';

  do {

--- 112,118 ---- { const int LEN = 11; char b[LEN]; ! int i = LEN - 1; b[i--] = '\0';

  do {

====

Comments (6)

  1. Rene Wilhelm

    It's a valid fix, but the whole int2str() routine feels weird. Why not use sprintf() or snprintf() instead of the loop which computes the characters one by one?

  2. Log in to comment