fjpanag commented on code in PR #1713:
URL: https://github.com/apache/nuttx-apps/pull/1713#discussion_r1172763218
##########
netutils/ftpc/ftpc_transfer.c:
##########
@@ -247,7 +247,10 @@ static FAR char *ftpc_abspath(FAR struct ftpc_session_s
*session,
else if (relpath[1] == '/')
{
- asprintf(&ptr, "%s%s", homedir, &relpath[1]);
+ if (asprintf(&ptr, "%s%s", homedir, &relpath[1]) < 0)
+ {
+ ptr = NULL;
Review Comment:
When `asprintf` fails, the contents of `ptr` are undefined. Since `ptr` is
returned at the end, it ensures that it will be `NULL` indicating the error
(and that it will not contain garbage).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]