understanding the dangers of sprintf(…)

前端 未结 8 1454

OWASP says:

\"C library functions such as strcpy (), strcat (), sprintf () and vsprintf () operate on null terminated strings and perform no bou

8条回答
  •  醉酒成梦
    2020-12-01 05:25

    Your 2 numbered conclusions are correct, but incomplete.

    There is an additional risk:

    char* format = 0;
    char buf[128];
    sprintf(buf, format, "hello");
    

    Here, format is not NULL-terminated. sprintf() doesn't check that either.

提交回复
热议问题