GUACAMOLE-303: Ensure there is always space for the null terminator when normalizing.

This commit is contained in:
Michael Jumper 2017-07-04 12:00:43 -07:00
parent 07db9808a0
commit 7857dd0a9a
2 changed files with 3 additions and 3 deletions

View File

@ -77,7 +77,7 @@ static int guac_common_ssh_sftp_normalize_path(char* fullpath,
strncpy(path_component_data, path, sizeof(path_component_data) - 1);
/* Find path components within path */
for (i = 0; i < sizeof(path_component_data); i++) {
for (i = 0; i < sizeof(path_component_data) - 1; i++) {
/* If current character is a path separator, parse as component */
char c = path_component_data[i];

View File

@ -622,10 +622,10 @@ int guac_rdp_fs_normalize_path(const char* path, char* abs_path) {
path++;
/* Copy path into component data for parsing */
strncpy(path_component_data, path, GUAC_RDP_FS_MAX_PATH-1);
strncpy(path_component_data, path, sizeof(path_component_data) - 1);
/* Find path components within path */
for (i=0; i<GUAC_RDP_FS_MAX_PATH; i++) {
for (i = 0; i < sizeof(path_component_data) - 1; i++) {
/* If current character is a path separator, parse as component */
char c = path_component_data[i];