Sydarkivera / RecursiveTar

A command line tool for extracting files in nested tar archives
GNU General Public License v3.0
0 stars 0 forks source link

strdup is not part of the C-standard, replace with safe malloc and strcpy #13

Closed lxutopia closed 1 day ago

lxutopia commented 3 days ago

https://github.com/Sydarkivera/RecursiveTar/blob/da10a2ce7ab84e34a04d2e888bcf3ebc5d0304b7/viewtar.c#L421-L426 The following code should be safe and standard:

char *path = (char *) malloc(strlen(argv[2]) + 1);
strcpy(path, argv[2]);
...
free(path);