• Tomasz Kramkowski's avatar
    Replace all uses of sprintf with snprintf · 2b5c1b4b
    Tomasz Kramkowski authored
    In all the cases where sprintf was being used within htop, snprintf
    could have been used. This patch replaces all uses of sprintf with
    snprintf which makes sure that if a buffer is too small to hold the
    resulting string, the string is simply cut short instead of causing
    a buffer overflow which leads to undefined behaviour.
    
    `sizeof(variable)` was used in these cases, as opposed to `sizeof
    variable` which is my personal preference because `sizeof(variable)`
    was already used in one way or another in other parts of the code.
    2b5c1b4b
Process.c 18.3 KB