Changeset 76775 in vbox for trunk/src/VBox
- Timestamp:
- Jan 11, 2019 1:06:44 PM (6 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/slirp.c
r76553 r76775 52 52 #include <iprt/assert.h> 53 53 #include <iprt/file.h> 54 #include <iprt/path.h> 54 55 #ifndef RT_OS_WINDOWS 55 56 # include <sys/ioctl.h> … … 579 580 WSACleanup(); 580 581 #endif 582 if (tftp_prefix) 583 RTStrFree((char *)tftp_prefix); 581 584 #ifdef LOG_ENABLED 582 585 Log(("\n" … … 1664 1667 { 1665 1668 Log2(("tftp_prefix: %s\n", tftpPrefix)); 1666 tftp_prefix = tftpPrefix; 1669 if (tftp_prefix) 1670 RTStrFree((char *)tftp_prefix); 1671 tftp_prefix = RTPathAbsDup(tftpPrefix); 1667 1672 } 1668 1673 -
trunk/src/VBox/Devices/Network/slirp/tftp.c
r76553 r76775 46 46 #include <iprt/file.h> 47 47 #include <iprt/err.h> 48 #include <iprt/path.h> 48 49 49 50 typedef enum ENMTFTPSESSIONFMT … … 133 134 DECLINLINE(int) tftpSecurityFilenameCheck(PNATState pData, PCTFTPSESSION pcTftpSession) 134 135 { 135 size_t cbSessionFilename = 0;136 136 int rc = VINF_SUCCESS; 137 137 AssertPtrReturn(pcTftpSession, VERR_INVALID_PARAMETER); 138 cbSessionFilename = RTStrNLen((const char *)pcTftpSession->pszFilename, TFTP_FILENAME_MAX);139 if ( !RTStrNCmp((const char*)pcTftpSession->pszFilename, "../", 3)140 || (pcTftpSession->pszFilename[cbSessionFilename - 1] == '/')141 || RTStrStr((const char *)pcTftpSession->pszFilename, "/../"))142 rc = VERR_FILE_NOT_FOUND;143 138 144 139 /* only allow exported prefixes */ 145 if ( RT_SUCCESS(rc) 146 && !tftp_prefix) 140 if (!tftp_prefix) 147 141 rc = VERR_INTERNAL_ERROR; 142 else 143 { 144 char *pszFullPathAbs = RTPathAbsExDup(tftp_prefix, (const char*)pcTftpSession->pszFilename); 145 146 if ( !pszFullPathAbs 147 || !RTPathStartsWith(pszFullPathAbs, tftp_prefix)) 148 rc = VERR_FILE_NOT_FOUND; 149 150 RTStrFree(pszFullPathAbs); 151 } 148 152 LogFlowFuncLeaveRC(rc); 149 153 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.