1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-01-26 12:01:54 +00:00

I7090: Fix filename validation in sim_load function.

This commit is contained in:
Mark Pizzolato
2016-07-14 06:52:50 -07:00
parent 74c49eeba7
commit 1a273eca6d

View File

@@ -227,7 +227,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag)
char *p;
int i, j;
if (match_ext(cptr, "crd")) {
if (match_ext(fnam, "crd")) {
int firstcard = 1;
uint16 image[80];
t_uint64 lbuff[24];
@@ -269,7 +269,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag)
dlen--;
}
}
} else if (match_ext(cptr, "cbn")) {
} else if (match_ext(fnam, "cbn")) {
int firstcard = 1;
uint16 image[80];
t_uint64 lbuff[24];
@@ -311,7 +311,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag)
dlen--;
}
}
} else if (match_ext(cptr, "oct")) {
} else if (match_ext(fnam, "oct")) {
while (fgets((char *)buffer, 80, fileref) != 0) {
for(p = (char *)buffer; *p == ' ' || *p == '\t'; p++);
/* Grab address */
@@ -326,7 +326,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag)
}
}
} else if (match_ext(cptr, "sym")) {
} else if (match_ext(fnam, "sym")) {
while (fgets((char *)buffer, 80, fileref) != 0) {
for(p = (char *)buffer; *p == ' ' || *p == '\t'; p++);
/* Grab address */