RSP: Fix undefined behavior in RDP_LogDlist
When calling sprintf, source and destination must not overlap otherwise it is undefined behavior as specified by C99 standard, 7.19.6.6. Signed-off-by: Francois Berder <fberder@outlook.fr>
This commit is contained in:
parent
a298011104
commit
f2e6199fcb
|
@ -182,17 +182,23 @@ void RDP_LogDlist ( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
for (count = 0; count < 0x10; count ++, Pos++ ) {
|
for (count = 0; count < 0x10; count ++, Pos++ ) {
|
||||||
|
char tmp[3];
|
||||||
if ((count % 4) != 0 || count == 0) {
|
if ((count % 4) != 0 || count == 0) {
|
||||||
sprintf(Hex,"%s %02X",Hex,Mem[Pos]);
|
sprintf(tmp,"%02X",Mem[Pos]);
|
||||||
|
strcat(Hex," ");
|
||||||
|
strcat(Hex,tmp);
|
||||||
} else {
|
} else {
|
||||||
sprintf(Hex,"%s - %02X",Hex,Mem[Pos]);
|
sprintf(tmp,"%02X",Mem[Pos]);
|
||||||
|
strcat(Hex," - ");
|
||||||
|
strcat(Hex,tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Mem[Pos] < 30 || Mem[Pos] > 127) {
|
if (Mem[Pos] < 30 || Mem[Pos] > 127) {
|
||||||
strcat(Ascii,".");
|
strcat(Ascii,".");
|
||||||
} else {
|
} else {
|
||||||
sprintf(Ascii,"%s%c",Ascii,Mem[Pos]);
|
sprintf(tmp,"%c",Mem[Pos]);
|
||||||
|
strcat(Ascii,tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RDP_Message(" %s %s",Hex, Ascii);
|
RDP_Message(" %s %s",Hex, Ascii);
|
||||||
|
|
Loading…
Reference in New Issue