Re: [PATCH net-next v3] tipc: replace deprecated strcpy with strscpy in tipc_bearer_get_name()
Ajith P V <[email protected]>
| Newsgroups | gmane.linux.network,gmane.network.tipc.general,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
Thank you Tung Quang Nguyen and David Laight for the suggestions. > Should the TIPC_MAX_BEARER_NAME requirement be spelled out in the comment > or in the prototype, so that the interface and the body agree? > In the current tree there is no behavioural change: the only caller is > __tipc_nl_add_monitor() in net/tipc/monitor.c, which declares > char bearer_name[TIPC_MAX_BEARER_NAME], and the source is > char name[TIPC_MAX_BEARER_NAME] in struct tipc_bearer, so the copy can > neither truncate nor overflow. > The strscpy() return value is also discarded, so a future caller passing a > smaller buffer would get a silently truncated name plus a return of 0. > Would passing a size_t len from the caller (sizeof(bearer_name)) and > forwarding strscpy()'s -E2BIG through the existing int return be preferable > to a hard-coded bound? I will update the patch with the above fixes and send the new version after Aug 31st. Regards, Ajith P V