tRequire exact matches of config names - vaccinewars - be a doctor and try to v… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b0756ad94e664d430149faa4c739f00346a5fdb3 | |
parent 6a57584d57e6e633b4224ba24fe4f1c955ef89be | |
Author: Ben Webb <[email protected]> | |
Date: Fri, 13 Nov 2020 00:24:28 -0800 | |
Require exact matches of config names | |
When looking up a configuration parameter by name, | |
require an exact match; don't match a parameter that | |
is shorter than the requested name (this erroneously | |
matches "Names.Bitch" when given "Names.Bitches"). | |
Diffstat: | |
M src/dopewars.c | 8 ++++---- | |
1 file changed, 4 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/src/dopewars.c b/src/dopewars.c | |
t@@ -1964,13 +1964,13 @@ int GetGlobalIndex(gchar *ID1, gchar *ID2) | |
if (!ID1) | |
return -1; | |
for (i = 0; i < NumGlob; i++) { | |
- if (g_ascii_strncasecmp(ID1, Globals[i].Name, strlen(Globals[i].Name)) == 0 | |
- && !Globals[i].NameStruct[0]) { | |
+ if (!ID2 && !Globals[i].NameStruct[0] | |
+ && g_ascii_strcasecmp(ID1, Globals[i].Name) == 0) { | |
/* Just a bog-standard ID1=value */ | |
return i; | |
} | |
- if (g_ascii_strncasecmp(ID1, Globals[i].NameStruct, strlen(Globals[i].Name… | |
- && g_ascii_strncasecmp(ID2, Globals[i].Name, strlen(Globals[i].Name)) … | |
+ if (g_ascii_strcasecmp(ID1, Globals[i].NameStruct) == 0 && ID2 | |
+ && g_ascii_strcasecmp(ID2, Globals[i].Name) == 0 | |
&& Globals[i].StructStaticPt && Globals[i].StructListPt) { | |
/* ID1[index].ID2=value */ | |
return i; |