Skip to content

Commit 031d542

Browse files
committed
load_umx: update:
- don't overzealously restrict umx files to known upkg versions. - lose the use of strcasecmp.
1 parent b7660b1 commit 031d542

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/load_umx.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Written by O. Sezer <[email protected]>
66
* UPKG parsing partially based on Unreal Media Ripper (UMR) v0.3
77
* by Andy Ward <[email protected]>, with additional updates
8-
* by O. Sezer - see git repo at https://github.com/sezero/umr/
8+
* by O. Sezer - see git repo at https://github.com/sezero/umr.git
99
* Retrieves the offset, size and object type directly from umx.
1010
*/
1111

@@ -183,6 +183,16 @@ static int read_typname(const BYTE *membase, LONG memlen,
183183
return 0;
184184
}
185185

186+
static void umx_strupr(char *str)
187+
{
188+
while (*str) {
189+
if (*str >= 'a' && *str <= 'z') {
190+
*str -= ('a' - 'A');
191+
}
192+
str++;
193+
}
194+
}
195+
186196
static int probe_umx (const BYTE *membase, LONG memlen,
187197
const struct upkg_hdr *hdr,
188198
LONG *ofs, LONG *objsize)
@@ -224,8 +234,9 @@ static int probe_umx (const BYTE *membase, LONG memlen,
224234
if (s <= 0 || s > memlen - pos) return -1;
225235

226236
if (read_typname(membase, memlen, hdr, t, buf) < 0) return -1;
237+
umx_strupr(buf);
227238
for (i = 0; mustype[i] != NULL; i++) {
228-
if (!strcasecmp(buf, mustype[i])) {
239+
if (!strcmp(buf, mustype[i])) {
229240
t = i;
230241
break;
231242
}
@@ -265,7 +276,7 @@ static int probe_header (void *header)
265276
return -1;
266277
}
267278

268-
#if 0
279+
#if 1 /* no need being overzealous */
269280
return 0;
270281
#else
271282
switch (hdr->file_version) {
@@ -283,7 +294,7 @@ static int probe_header (void *header)
283294
}
284295
285296
return -1;/* Unknown upkg version for an UMX */
286-
#endif
297+
#endif /* #if 0 */
287298
}
288299

289300
static int process_upkg (const BYTE *membase, LONG memlen,

0 commit comments

Comments
 (0)