• willy tarreau's avatar
    fix "ss -p" segfaults · 0ee9052f
    willy tarreau authored
    I've updated Jose's patch to make it slightly simpler (eg: calloc instead
    of malloc+memset), and ported it to 4.2.0 which requires it as well, and
    attached it to this e-mail.
    
    I can confirm that with this patch 4.1.1 doesn't segfault on me anymore.
    The commit message should be reworked I guess though everything's in it
    and I didn't want to modify his description.
    
    Can it be merged as-is or should I reword the commit message and reference
    Jose as the fix reporter ? We should not let this bug live forever.
    
    From: "j.ps@openmailbox.org" <j.ps@openmailbox.org>
    
    Essentially all that is needed to get rid of this issue is the
    addition of:
    
        memset(u, 0, sizeof(*u));
    
    after:
    
        if (!(u = malloc(sizeof(*u))))
                break;
    
    Also patched some other situations (strcpy and sprintf uses) that
    potentially produce the same results.
    Signed-off-by: default avatarJose P Santos <j.ps@openmailbox.org>
    
    [ wt: made Jose's patch slightly simpler, all credits to him for the diag ]
    Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
    0ee9052f
ss.c 87.3 KB