Menu

#7 arptables.c:765: possible missing string termination

v1.0 (example)
closed
nobody
None
5
2014-08-16
2014-04-23
dcb
No

[arptables.c:765]: (error) Dangerous usage of 'buf' (strncpy doesn't always null-terminate it).

Source code is

strncpy(buf, name, sizeof(buf) - 1);
if ((p = strrchr(buf, '/')) != NULL) {

Maybe better code

strncpy(buf, name, sizeof(buf) - 1);
buf[ sizeof(buf) - 1] = '\0';
if ((p = strrchr(buf, '/')) != NULL) {

Discussion

  • Bart De Schuymer

    thanks, applied.

     
  • Bart De Schuymer

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB