Evil portal fix zero terminated ap name

This commit is contained in:
Willy-JL
2023-11-20 03:38:21 +00:00
parent e22fa80abe
commit 82cdab831f

View File

@@ -83,7 +83,7 @@ void evil_portal_read_ap_name(void* context) {
if(storage_common_stat(storage, EVIL_PORTAL_AP_SAVE_PATH, &fi) == FSE_OK) {
File* ap_name = storage_file_alloc(storage);
if(storage_file_open(ap_name, EVIL_PORTAL_AP_SAVE_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
app->ap_name = malloc((size_t)fi.size);
app->ap_name = malloc((size_t)fi.size + 1);
uint8_t* buf_ptr = app->ap_name;
size_t read = 0;
while(read < fi.size) {
@@ -93,6 +93,8 @@ void evil_portal_read_ap_name(void* context) {
read += now_read;
buf_ptr += now_read;
}
*buf_ptr = '\0';
buf_ptr++;
free(buf_ptr);
}
storage_file_close(ap_name);