From e3506c0f10788e3e81b6db9b788aa48fe8c83f07 Mon Sep 17 00:00:00 2001 From: longpanda Date: Thu, 17 Feb 2022 11:09:31 +0800 Subject: [PATCH] Add cmdline check --- Vlnk/src/main_windows.c | 23 ++++++++++++++-------- Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe | Bin 121344 -> 121856 bytes 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Vlnk/src/main_windows.c b/Vlnk/src/main_windows.c index 34f75483..08951202 100644 --- a/Vlnk/src/main_windows.c +++ b/Vlnk/src/main_windows.c @@ -393,12 +393,12 @@ static BOOL IsSupportedVlnkSuffix(WCHAR *FileName) if (len > 9) { - if (lstrcmp(FileName - 9, L".vlnk.iso") == 0 || - lstrcmp(FileName - 9, L".vlnk.img") == 0 || - lstrcmp(FileName - 9, L".vlnk.wim") == 0 || - lstrcmp(FileName - 9, L".vlnk.vhd") == 0 || - lstrcmp(FileName - 9, L".vlnk.efi") == 0 || - lstrcmp(FileName - 9, L".vlnk.dat") == 0) + if (lstrcmp(FileName + len - 9, L".vlnk.iso") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.img") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.wim") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.vhd") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.efi") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.dat") == 0) { return TRUE; } @@ -407,8 +407,8 @@ static BOOL IsSupportedVlnkSuffix(WCHAR *FileName) if (len > 10) { - if (lstrcmp(FileName - 10, L".vlnk.vhdx") == 0 || - lstrcmp(FileName - 9, L".vlnk.vtoy") == 0) + if (lstrcmp(FileName + len - 10, L".vlnk.vhdx") == 0 || + lstrcmp(FileName + len - 10, L".vlnk.vtoy") == 0) { return TRUE; } @@ -879,6 +879,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi return 1; } + if (!IsSupportedVlnkSuffix(g_CmdOutFile)) + { + LogW(L"File <<%ls>> contains invalid vlnk suffix!\n", g_CmdOutFile); + VtoyMessageBox(NULL, g_msg_lang[MSGID_INVALID_SUFFIX], g_msg_lang[MSGID_ERROR], MB_OK | MB_ICONERROR); + return 1; + } + return CreateVlnk(NULL, g_CurDirW, g_CmdInFile, g_CmdOutFile); } else diff --git a/Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe b/Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe index ac8bfa3c2fa1e8faafa4af353ce9bd728bb98794..0f479e1053d6ab21c2cc38b48ce01bff2c03cdc1 100644 GIT binary patch delta 7948 zcmeI0dt4ON+rZCR5D-z2i(Ca%6!SW>bJ^LM*_mAvK_x>)G!;cfTJai!w=^_BGX&9N zE|`_3sg;?!6>6p=mN!%^FQk^JSc6%inOA=9`^=)h`h4EopYK2K@cGU;^PK10pXWJe zS^Syz;yvDFO`QkqZ#xk^ed>_`x50i0#bJc%TZBF$3B+lJsMRDJcg9tu1a~o{l#tz+ z=h@Dn7659xy64k2o+hyfW%S9(oRB*Kp)W>*& zMw{CWp@PHRi(hDFPL9)#l6)_lAvTsA@{(~9ae3LoJv!?O0VO5P|8lvs9Zy^?x32a( zdCB`E)=0e1&juV${9C^VWBRl;g@xD$SB{QxSACDW*U4$$xYu1{i98SAxI@B z+B^r1|JBB7Xdg^We%@{!b3%Zo7@{ht($PWJ~Hu;%i?#s`V>fK7rzYB&uE705p z5$(wn|4;*NPeKE7@bl!&fb)1Enb7{R!7G4_3k-|S5@1=9P++oYod0rbfF-(t{QoLfVm85gkc$ z(CE;!Apg&57s>QsE3P0rf(v|q1Zyrh99B{^k5E2+$dnK#zC${8_!`^El@8Av;#!lq zP|ETK;~o=Jm9@O6{;|tt_kuyDloVZqe2SL+k5UZ`$nM)xdK2;~S~6J`T7w(OxUfQ> zn_jT;Re3hDDj=MAgvT1Xc$2Q-hufutT;DeT163(n1GyhQ7d&8Qgaxm2eiCs4`or^hh%wPGuUd>9={UjPcaz= zpZ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