mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-16 03:06:45 -04:00
fix buffer overflow in chargen + CRT effect
This commit is contained in:
parent
f169aa5071
commit
ebcd71ece8
5 changed files with 48 additions and 5 deletions
|
@ -454,7 +454,7 @@ static char select_xicht(int id,int xa,int ya,int xr,int yr)
|
|||
def_handle(H_XICHTY+cur_edited,s,pcx_8bit_decomp,SR_BGRAFIKA);
|
||||
sprintf(s,CHAR_NAME,k);
|
||||
def_handle(H_POSTAVY+cur_edited,s,pcx_8bit_decomp,SR_BGRAFIKA);
|
||||
for(j=0;j<MAX_XICHTS;j++) if (postavy[j].used) disable[postavy[j].xicht]=1;
|
||||
for(j=0;j<POCET_POSTAV;j++) if (postavy[j].used) disable[postavy[j].xicht]=1;
|
||||
error_text=NULL;
|
||||
bott_draw(1);
|
||||
redraw_generator(1);
|
||||
|
|
|
@ -567,7 +567,7 @@ static int enum_all_status(FILE *f, ENUM_ALL_STATUS_CALLBACK_RESULT (*cb)(FILE *
|
|||
}
|
||||
}
|
||||
|
||||
static ENUM_ALL_STATUS_CALLBACK_RESULT unpack_status_callback(FILE *f, const char *name, size_t datasize, void *) {
|
||||
static ENUM_ALL_STATUS_CALLBACK_RESULT unpack_status_callback(FILE *f, const char *name, size_t datasize, void *_) {
|
||||
void *buff = getmem(datasize);
|
||||
if (fread(buff, 1, datasize, f) != datasize) {
|
||||
free(buff);
|
||||
|
|
|
@ -200,7 +200,7 @@ void load_spells_legacy_format(void **p, int32_t *s) {
|
|||
k = (*p);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
char *b = (char *)k;
|
||||
char traceon = k->spellname[-1]; //traceon was there;
|
||||
char traceon = *(k->spellname-1); //traceon was there;
|
||||
size_t bofs = offsetof(TKOUZLO, traceon);
|
||||
size_t eofs = offsetof(TKOUZLO, spellname)-1;
|
||||
memmove(b+bofs+1, b+bofs, eofs-bofs);\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue