diff --git a/src/hdd.c b/src/hdd.c index 51595460f..f3bc13183 100644 --- a/src/hdd.c +++ b/src/hdd.c @@ -137,7 +137,7 @@ struct GameDataEntry { u32 lba, size; struct GameDataEntry *next; - char id[APA_IDMAX]; + char id[APA_IDMAX + 1]; }; static int hddGetHDLGameInfo(struct GameDataEntry *game, hdl_game_info_t *ginfo) @@ -152,7 +152,9 @@ static int hddGetHDLGameInfo(struct GameDataEntry *game, hdl_game_info_t *ginfo) strncpy(ginfo->partition_name, game->id, APA_IDMAX); ginfo->partition_name[APA_IDMAX] = '\0'; strncpy(ginfo->name, hdl_header->gamename, HDL_GAME_NAME_MAX); + ginfo->name[HDL_GAME_NAME_MAX] = '\0'; strncpy(ginfo->startup, hdl_header->startup, sizeof(ginfo->startup) - 1); + ginfo->startup[sizeof(ginfo->startup) - 1] = '\0'; ginfo->hdl_compat_flags = hdl_header->hdl_compat_flags; ginfo->ops2l_compat_flags = hdl_header->ops2l_compat_flags; ginfo->dma_type = hdl_header->dma_type; @@ -207,6 +209,7 @@ int hddGetHDLGamelist(hdl_games_list_t *game_list) break; strncpy(current->id, dirent.name, APA_IDMAX); + current->id[APA_IDMAX] = '\0'; count++; current->next = NULL; current->size = 0;