diff --git a/src/drive.c b/src/drive.c index f2f57e0e..411bac45 100644 --- a/src/drive.c +++ b/src/drive.c @@ -170,7 +170,7 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label) // to insert media. Use IOCTL_STORAGE_CHECK_VERIFY to prevent this hPhysical = GetDriveHandle(DriveIndex, NULL, FALSE, FALSE); if (DeviceIoControl(hPhysical, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, &size, NULL)) - AutorunLabel = get_token_data(AutorunPath, "label"); + AutorunLabel = get_token_data_file("label", AutorunPath); else if (GetLastError() == ERROR_NOT_READY) uprintf("Ignoring autorun.inf label for drive %c: %s\n", *letter, (HRESULT_CODE(GetLastError()) == ERROR_NOT_READY)?"No media":WindowsErrorString()); diff --git a/src/iso.c b/src/iso.c index 06c5bfc3..d7a7841f 100644 --- a/src/iso.c +++ b/src/iso.c @@ -480,7 +480,7 @@ out: safe_sprintf(path, sizeof(path), "/%s/txtsetup.sif", basedir[((iso_report.winpe&WINPE_I386) == WINPE_I386)?0:1]); ExtractISOFile(src_iso, path, tmp_sif); - tmp = get_token_data(tmp_sif, "OsLoadOptions"); + tmp = get_token_data_file("OsLoadOptions", tmp_sif); if (tmp != NULL) { for (i=0; i better safe than sorry + if ((token == NULL) || (buffer == NULL) || (buffer_size <= 4) || (buffer_size > 65536)) + goto out; + + // Ensure that our buffer is NUL terminated + if (buffer[buffer_size-1] != 0) + goto out; + + wbuffer = utf8_to_wchar(buffer); + wtoken = utf8_to_wchar(token); + if ((wbuffer == NULL) || (wtoken == NULL)) + goto out; + + // Process individual lines + for (i=0,j=0,done=FALSE; (j!=n)&&(!done); ) { + wline = &wbuffer[i]; + + for(;(wbuffer[i]!=L'\n')&&(wbuffer[i]!=L'\r')&&(wbuffer[i]!=0);i++); + if (wbuffer[i]==0) { + done = TRUE; + } else { + wbuffer[i++] = 0; + } + wdata = get_token_data_line(wtoken, wline); + if (wdata != NULL) { + j++; + } + } +out: + if (wdata != NULL) + ret = wchar_to_utf8(wdata); + safe_free(wbuffer); + safe_free(wtoken); + return ret; +} + +static __inline char* get_sanitized_token_data_buffer(const char* token, unsigned int n, const char* buffer, size_t buffer_size) +{ + size_t i; + char* data = get_token_data_buffer(token, n, buffer, buffer_size); + if (data != NULL) { + for (i=0; i(){}[].,:;#@'/?|~"; + rufus_update update; + + // Sanitize the data - Of course not a silver bullet, but it helps + for (i=0; ihttp://rufus.akeo.ie",IDC_ABOUT_RUFUS_URL, "SysLink",WS_TABSTOP,46,47,114,9 - LTEXT "Version 1.2.0 (Build 192)",IDC_STATIC,46,19,78,8 + LTEXT "Version 1.2.0 (Build 193)",IDC_STATIC,46,19,78,8 PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,107,235,63,WS_EX_STATICEDGE LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 @@ -237,8 +237,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2,0,192 - PRODUCTVERSION 1,2,0,192 + FILEVERSION 1,2,0,193 + PRODUCTVERSION 1,2,0,193 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -255,13 +255,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.2.0.192" + VALUE "FileVersion", "1.2.0.193" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.2.0.192" + VALUE "ProductVersion", "1.2.0.193" END END BLOCK "VarFileInfo"