mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
The parser for Rockridge symlinks tended to insert
extra slashes at the beginning of absolute targets. Thanks to Jung-uk Kim for pointing this out to me. Approved by: re (kib)
This commit is contained in:
parent
47a490cbbc
commit
33fe28bbcd
1 changed files with 8 additions and 8 deletions
|
|
@ -1175,12 +1175,12 @@ static void
|
|||
parse_rockridge_SL1(struct file_info *file, const unsigned char *data,
|
||||
int data_length)
|
||||
{
|
||||
int component_continues = 1;
|
||||
const char *separator = "";
|
||||
|
||||
if (!file->symlink_continues)
|
||||
if (!file->symlink_continues || file->symlink.length < 1)
|
||||
archive_string_empty(&file->symlink);
|
||||
else
|
||||
archive_strcat(&file->symlink, "/");
|
||||
else if (file->symlink.s[file->symlink.length - 1] != '/')
|
||||
separator = "/";
|
||||
file->symlink_continues = 0;
|
||||
|
||||
/*
|
||||
|
|
@ -1217,9 +1217,8 @@ parse_rockridge_SL1(struct file_info *file, const unsigned char *data,
|
|||
unsigned char nlen = *data++;
|
||||
data_length -= 2;
|
||||
|
||||
if (!component_continues)
|
||||
archive_strcat(&file->symlink, "/");
|
||||
component_continues = 0;
|
||||
archive_strcat(&file->symlink, separator);
|
||||
separator = "/";
|
||||
|
||||
switch(flag) {
|
||||
case 0: /* Usual case, this is text. */
|
||||
|
|
@ -1233,7 +1232,7 @@ parse_rockridge_SL1(struct file_info *file, const unsigned char *data,
|
|||
return;
|
||||
archive_strncat(&file->symlink,
|
||||
(const char *)data, nlen);
|
||||
component_continues = 1;
|
||||
separator = "";
|
||||
break;
|
||||
case 0x02: /* Current dir. */
|
||||
archive_strcat(&file->symlink, ".");
|
||||
|
|
@ -1244,6 +1243,7 @@ parse_rockridge_SL1(struct file_info *file, const unsigned char *data,
|
|||
case 0x08: /* Root of filesystem. */
|
||||
archive_string_empty(&file->symlink);
|
||||
archive_strcat(&file->symlink, "/");
|
||||
separator = "";
|
||||
break;
|
||||
case 0x10: /* Undefined (historically "volume root" */
|
||||
archive_string_empty(&file->symlink);
|
||||
|
|
|
|||
Loading…
Reference in a new issue