From 63711dd31237b79d24f3f7e4e33fe17765685d68 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 13 Oct 2019 00:31:21 +0200 Subject: [PATCH] =?UTF-8?q?fix=20gcc8=20failure,=20man=20sprintf:=20Some?= =?UTF-8?q?=20programs=20imprudently=20rely=20on=20code=20such=20as=20the?= =?UTF-8?q?=20following=20sprintf(buf,=20"%s=20some=20further=20text",=20b?= =?UTF-8?q?uf);=20to=20append=20text=20to=20buf.=20=20However,=20the=20sta?= =?UTF-8?q?ndards=20explicitly=20note=20that=20the=20results=20are=20undef?= =?UTF-8?q?ined=20if=20source=20and=20destination=20buffers=20overlap=20?= =?UTF-8?q?=20when=20=20calling=20=20sprintf(),=20=20snprintf(),=20=20vspr?= =?UTF-8?q?intf(),=20=20and=20=20vs=E2=80=90=20nprintf().=20=20Depending?= =?UTF-8?q?=20on=20the=20version=20of=20gcc(1)=20used,=20and=20the=20compi?= =?UTF-8?q?ler=20options=20employed,=20calls=20such=20as=20the=20above=20w?= =?UTF-8?q?ill=20not=20produce=20the=20expected=20results.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/cmdlft55xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 2894faa46..ccabadeb4 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -2262,11 +2262,11 @@ static int CmdT55xxDump(const char *Cmd) { strcpy (preferredName,"lf-t55xx"); for (uint8_t i = 1; i <= 7; i++) { if ((cardmem[i].blockdata != 0x00) && (cardmem[i].blockdata != 0xFFFFFFFF)) - sprintf (preferredName,"%s-%08X",preferredName,cardmem[i].blockdata); + sprintf (preferredName + strlen(preferredName),"-%08X",cardmem[i].blockdata); else break; } - sprintf (preferredName,"%s-data",preferredName); + strcat (preferredName,"-data"); } // Swap endian so the files match the txt display