Fix handling of malformed scale: and proxy: arguments

This commit is contained in:
Tamás Bálint Misius 2022-06-13 13:40:41 +02:00
parent 833973f1fc
commit 289c2c4528
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -332,22 +332,17 @@ std::map<ByteString, ByteString> readArguments(int argc, char * argv[])
arguments["open"] = ""; arguments["open"] = "";
arguments["ddir"] = ""; arguments["ddir"] = "";
arguments["ptsave"] = ""; arguments["ptsave"] = "";
arguments["font"] = "";
for (int i=1; i<argc; i++) for (int i=1; i<argc; i++)
{ {
if (!strncmp(argv[i], "scale:", 6) && argv[i]+6) if (!strncmp(argv[i], "scale:", 6) && argv[i][6])
{ {
arguments["scale"] = argv[i]+6; arguments["scale"] = &argv[i][6];
}
if (!strncmp(argv[i], "font:", 5) && argv[i]+5)
{
arguments["font"] = argv[i]+5;
} }
else if (!strncmp(argv[i], "proxy:", 6)) else if (!strncmp(argv[i], "proxy:", 6))
{ {
if(argv[i]+6) if(argv[i][6])
arguments["proxy"] = argv[i]+6; arguments["proxy"] = &argv[i][6];
else else
arguments["proxy"] = "false"; arguments["proxy"] = "false";
} }