Menu

#28 pptp_callmgr.c:416: strncpy problems * 2

none
closed
None
3
2014-09-08
2014-09-07
dcb
No

[pptp_callmgr.c:416]: (error) Dangerous usage of 'localaddr' (strncpy doesn't always null-terminate it).
[pptp_callmgr.c:416]: (error) Dangerous usage of 'remoteaddr' (strncpy doesn't always null-terminate it).

strncpy(localaddr,  inet_ntoa(localbind), 16);
strncpy(remoteaddr, inet_ntoa(inetaddr),  16);
snprintf(where->sun_path, sizeof(where->sun_path),
        PPTP_SOCKET_PREFIX "%s:%s", localaddr, remoteaddr);

Belt'n'braces programming. Always make sure to put in a zero
byte after any call to strncpy.

Discussion

  • James Cameron

    James Cameron - 2014-09-08
    • status: open --> closed
    • assigned_to: James Cameron
    • Priority: 1 --> 3
     

Log in to post a comment.

MongoDB Logo MongoDB