Follow-up Comment #2, bug #52220 (project findutils):

Reproduces here:


Program received signal SIGSEGV, Segmentation fault.
0x00007ffff775c2d2 in strtok_r () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff775c2d2 in strtok_r () from /usr/lib/libc.so.6
#1  0x0000555555561359 in process_debug_options (arg=0x0) at util.c:851
#2  process_leading_options (argc=<optimized out>, argv=<optimized out>) at
util.c:973
#3  0x000055555555afba in main (argc=2, argv=0x7fffffffdcf8) at ftsfind.c:693


The code does


      else if (0 == strcmp ("-D", argv[i]))
        {
          process_debug_options (argv[i+1]);
          ++i;                  /* skip the argument too. */
        }


but argv[i+1] is NULL.  The first thing process_debug_options() does is


  p = strtok_r (arg, delimiters, &token_context);


NULL arg is invalid as the first call to strtok_r.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52220>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


Reply via email to