| 82 | |
| 83 | |
| 84 | bool ExtractUnixLink50(CommandData *Cmd,const wchar *Name,FileHeader *hd) |
| 85 | { |
| 86 | char Target[NM]; |
| 87 | WideToChar(hd->RedirName,Target,ASIZE(Target)); |
| 88 | if (hd->RedirType==FSREDIR_WINSYMLINK || hd->RedirType==FSREDIR_JUNCTION) |
| 89 | { |
| 90 | // Cannot create Windows absolute path symlinks in Unix. Only relative path |
| 91 | // Windows symlinks can be created here. RAR 5.0 used \??\ prefix |
| 92 | // for Windows absolute symlinks, since RAR 5.1 /??/ is used. |
| 93 | // We escape ? as \? to avoid "trigraph" warning |
| 94 | if (strncmp(Target,"\\??\\",4)==0 || strncmp(Target,"/\?\?/",4)==0) |
| 95 | return false; |
| 96 | DosSlashToUnix(Target,Target,ASIZE(Target)); |
| 97 | } |
| 98 | // Use hd->FileName instead of LinkName, since LinkName can include |
| 99 | // the destination path as a prefix, which can confuse |
| 100 | // IsRelativeSymlinkSafe algorithm. |
| 101 | if (!Cmd->AbsoluteLinks && (IsFullPath(Target) || |
| 102 | !IsRelativeSymlinkSafe(Cmd,hd->FileName,Name,hd->RedirName))) |
| 103 | return false; |
| 104 | return UnixSymlink(Target,Name,&hd->mtime,&hd->atime); |
| 105 | } |
no test coverage detected