strncpy() max size calculation on win32api/dosio.c is wrong.
For example in case curpath is ".//keropi/" (10 byte length), strncpy() append filename only 10byte.
It means reading BIOS ROM "iplrom.dat" will be success ( curpath ".//keropi/iplrom.dat" will be generated ) however, reading BIOS ROM "iplrom30.dat" will be fail ( curpath ".//keropi/iplrom30.d" will be generated ).
And if length of curpath is longher than 0.5*(MAX_PATH+32) byte, strncpy() shall run over curpath buffer.
strncpy() max size must be smaller than MAX_PATH + 32 - (curfilep - curpath). Considering 32 byte as safe margin, correct max size will be MAX_PATH - (curfilep - curpath).
strncpy() max size calculation on win32api/dosio.c is wrong.
For example in case curpath is ".//keropi/" (10 byte length), strncpy() append filename only 10byte. It means reading BIOS ROM "iplrom.dat" will be success ( curpath ".//keropi/iplrom.dat" will be generated ) however, reading BIOS ROM "iplrom30.dat" will be fail ( curpath ".//keropi/iplrom30.d" will be generated ).
And if length of curpath is longher than
0.5*(MAX_PATH+32)
byte, strncpy() shall run over curpath buffer. strncpy() max size must be smaller thanMAX_PATH + 32 - (curfilep - curpath)
. Considering 32 byte as safe margin, correct max size will beMAX_PATH - (curfilep - curpath)
.