[Bug 8661] ash: segmentation fault in trapcmd: `trap '' 255`

bugzilla at busybox.net bugzilla at busybox.net
Mon Aug 6 11:44:19 UTC 2018


https://bugs.busybox.net/show_bug.cgi?id=8661

Denys Vlasenko <vda.linux at googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Denys Vlasenko <vda.linux at googlemail.com> ---
The place where it happens:
        char *trap[NSIG];
...
                signo = get_signum(*ap);
...
                free(trap[signo]);

This was fixed by not allowing get_signum() to return >= NSIG:

int FAST_FUNC get_signum(const char *name)
{
        unsigned i;

        i = bb_strtou(name, NULL, 10);
        if (!errno && i < NSIG) /* for shells, we allow 0 too */
                      ^^^^^^^^
                return i;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list