Skip to content
Snippets Groups Projects
Commit 0888e3fb authored by Brian Carrier's avatar Brian Carrier
Browse files

removed loop to clean up path

parent dd1ed908
Branches
No related tags found
No related merge requests found
...@@ -777,21 +777,17 @@ int ...@@ -777,21 +777,17 @@ int
// clean up path // clean up path
size_t path_len = strlen(path); // +2 = space for leading slash and terminating null
size_t epath_len = path_len*2; size_t path_len = strlen(path) + 2;
char * char *
escaped_path; escaped_path;
if ((escaped_path = (char *) tsk_malloc(epath_len + 2)) == NULL) { // +2 = space for leading slash and terminating null if ((escaped_path = (char *) tsk_malloc(path_len)) == NULL) {
free(name); free(name);
return 1; return 1;
} }
size_t k = 0; strncpy(escaped_path, "/", path_len);
escaped_path[k++] = '/'; // add a leading slash strncat(escaped_path, path, path_len);
for (size_t i = 0; i < path_len && k < epath_len; i++) {
escaped_path[k++] = path[i];
}
escaped_path[k++] = '\0';
char md5Text[48] = "NULL"; char md5Text[48] = "NULL";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment