fixed compile errors and buffer overflow for bworld

This commit is contained in:
qeed 2010-09-03 17:11:45 +00:00
parent 0666741d55
commit d89fdac566
3 changed files with 5 additions and 6 deletions

View File

@ -348,7 +348,7 @@ static void ListCheats(void)
{ {
char tmp[32]; char tmp[32];
printf(" <(T)oggle status, (M)odify, or (D)elete this cheat.> "); printf(" <(T)oggle status, (M)odify, or (D)elete this cheat.> ");
fgets(tmp,ARRAY_SIZE(buf),stdin); fgets(tmp,ARRAY_SIZE(tmp),stdin);
switch(tolower(tmp[0])) switch(tolower(tmp[0]))
{ {
case 't':ToggleCheat(which); case 't':ToggleCheat(which);
@ -405,7 +405,7 @@ static int ShowShortList(char *moe[], int n, int def)
clo: clo:
printf("\nSelection [%d]> ",def+1); printf("\nSelection [%d]> ",def+1);
fgets(tmp,ARRAY_SIZE(buf),stdin); fgets(tmp,ARRAY_SIZE(tmp),stdin);
if(tmp[0]=='\n') if(tmp[0]=='\n')
return def; return def;
c=tolower(tmp[0]); c=tolower(tmp[0]);

View File

@ -22,7 +22,7 @@
#include "share.h" #include "share.h"
static int seq,ptr,bit,cnt,have; static int seq,ptr,bit,cnt,have;
static uint8 bdata[20]; static uint8 bdata[32];
static uint8 Read(int w, uint8 ret) static uint8 Read(int w, uint8 ret)
@ -60,8 +60,7 @@ static void Update(void *data, int arg)
*(uint8 *)data=0; *(uint8 *)data=0;
seq=ptr=0; seq=ptr=0;
have=1; have=1;
strcpy((char*)bdata,(char *)data+1); //mbg merge 7/17/06 added casts snprintf((char*)bdata, ARRAY_SIZE(bdata), "%s%s", (char*) data + 1, "SUNSOFT"); //mbg merge 7/17/06
strcpy((char*)&bdata[13],"SUNSOFT"); //mbg merge 7/17/06 added cast
} }
} }

View File

@ -543,7 +543,7 @@ EFCM_CONVERTRESULT convert_fcm(MovieData& md, std::string fname)
EMUFILE* fp = FCEUD_UTF8_fstream(fname, "rb"); EMUFILE* fp = FCEUD_UTF8_fstream(fname, "rb");
if(!fp) false; if(!fp) FCM_CONVERTRESULT_FAILOPEN;
// read header // read header
uint32 magic = 0; uint32 magic = 0;