X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fclient%2Fio.c;h=c047f6985d3f9526cc45eb4fa845be77ad9677e2;hb=aaa8274f5566c6f1a16bb3c8971f422ff06d0e37;hp=31387f26d8466aeade7e293d2be5d06b0937aad2;hpb=7e43b1fff89706212291384ddaa762fa30b02cb4;p=plomrogue diff --git a/src/client/io.c b/src/client/io.c index 31387f2..c047f69 100644 --- a/src/client/io.c +++ b/src/client/io.c @@ -106,7 +106,8 @@ static void read_inventory(char * read_buf, uint32_t linemax, FILE * file) int new_size = strlen(read_buf); char * new_inventory = try_malloc(old_size + new_size + 1, f_name); memcpy(new_inventory, world.player_inventory, old_size); - sprintf(new_inventory + old_size, "%s", read_buf); + int test = sprintf(new_inventory + old_size, "%s", read_buf); + exit_trouble(test < 0, f_name, "sprintf()"); free(world.player_inventory); world.player_inventory = new_inventory; } @@ -150,7 +151,8 @@ static void read_log(char * read_buf, uint32_t linemax, FILE * file) int new_size = strlen(read_buf); char * new_log = try_malloc(old_size + new_size + 1, f_name); memcpy(new_log, world.log, old_size); - sprintf(new_log + old_size, "%s", read_buf); + int test = sprintf(new_log + old_size, "%s", read_buf); + exit_trouble(test < 0, f_name, "sprintf()"); free(world.log); world.log = new_log; }