From 0034bb4e966b6f865f318d5285ad43148f733c79 Mon Sep 17 00:00:00 2001 From: relesgoe <RElesgoe@users.noreply.github.com> Date: Fri, 21 Aug 2020 14:52:00 -0700 Subject: [PATCH] Replace call to std::strncpy() with std::snprintf() in d2ladder_readladder() because std::strncpy() may not null-terimate the destination string --- src/d2dbs/d2ladder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d2dbs/d2ladder.cpp b/src/d2dbs/d2ladder.cpp index 923b6d3..8efcd75 100644 --- a/src/d2dbs/d2ladder.cpp +++ b/src/d2dbs/d2ladder.cpp @@ -452,7 +452,7 @@ namespace pvpgn temp.status = bn_short_get(ldata[i].status); temp.level = bn_byte_get(ldata[i].level); temp.chclass = bn_byte_get(ldata[i].chclass); - std::strncpy(temp.charname, ldata[i].charname, sizeof(info[i].charname)); + std::snprintf(temp.charname, sizeof(temp.charname), "%s", ldata[i].charname); if (d2ladder_update_info_and_pos(d2ladder, &temp, d2ladder_find_char_all(d2ladder, &temp), d2ladder_find_pos(d2ladder, &temp)) == 1) {