mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
misc: Use strncpy instead of strcat.
This is just hardening the code. Found by Coverity.
This commit is contained in:
@@ -777,7 +777,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
strcat(buf + l, x);
|
strncpy(buf + l, x, sizeof(buf) - l - 1);
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
SAFE_FREE(x);
|
SAFE_FREE(x);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user