Skip to content

Commit

Permalink
Remove unreachable code
Browse files Browse the repository at this point in the history
gnu_hack_string was always NULL, so anything under if (gnu_hack_string)
is unreachable code.

(cherry picked from commit da104e4)
  • Loading branch information
DemiMarie authored and marmarek committed Nov 5, 2024
1 parent 102acac commit d49f251
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions qubes-rpc/tar2qfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ typedef struct {
*/

static unsigned long tar_chksm (char *, int);
char *gnu_hack_string; /* GNU ././@LongLink hackery */

char untrusted_namebuf[MAX_PATH_LENGTH];
int use_seek = 1;
Expand Down Expand Up @@ -468,15 +467,8 @@ ustar_rd (int fd, struct file_header * untrusted_hdr, char *buf, struct stat * s
*dest++ = '/';
cnt++;
}
if (gnu_hack_string)
{
untrusted_hdr->namelen = cnt + strlen(strncpy (dest, gnu_hack_string,
MIN(TNMSZ+1, sizeof (untrusted_namebuf) - cnt)));
free(gnu_hack_string);
gnu_hack_string = NULL;
} else
untrusted_hdr->namelen = cnt + strlen(strncpy (dest, hd->name,
MIN(TNMSZ+1, sizeof (untrusted_namebuf) - cnt)));
untrusted_hdr->namelen = cnt + strlen(strncpy (dest, hd->name,
MIN(TNMSZ+1, sizeof (untrusted_namebuf) - cnt)));

// qfile count the \0 in the namelen
untrusted_hdr->namelen += 1;
Expand Down

0 comments on commit d49f251

Please sign in to comment.