From 37307535a26cf50b68b8865236c1b5444bdf2ea9 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 18 Sep 2024 14:20:16 -0700 Subject: [PATCH] sfnt2fon: Replace sprintf with snprintf to avoid deprecation warnings on macOS. --- tools/sfnt2fon/sfnt2fon.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/sfnt2fon/sfnt2fon.c b/tools/sfnt2fon/sfnt2fon.c index 2c307dcce8a..bf31124aa25 100644 --- a/tools/sfnt2fon/sfnt2fon.c +++ b/tools/sfnt2fon/sfnt2fon.c @@ -881,12 +881,15 @@ int main(int argc, char **argv) name = get_face_name( info[i] ); fontdir_len += 0x74 + strlen(name) + 1; if(i == 0) { - sprintf(non_resident_name, "FONTRES 100,%d,%d : %s %d", - info[i]->hdr.fi.dfVertRes, info[i]->hdr.fi.dfHorizRes, - name, info[i]->hdr.fi.dfPoints ); + snprintf(non_resident_name, sizeof(non_resident_name), + "FONTRES 100,%d,%d : %s %d", + info[i]->hdr.fi.dfVertRes, info[i]->hdr.fi.dfHorizRes, + name, info[i]->hdr.fi.dfPoints ); strcpy(resident_name, name); } else { - sprintf(non_resident_name + strlen(non_resident_name), ",%d", info[i]->hdr.fi.dfPoints ); + snprintf(non_resident_name + strlen(non_resident_name), + sizeof(non_resident_name) - strlen(non_resident_name), + ",%d", info[i]->hdr.fi.dfPoints ); } }