mirror of https://github.com/ARMmbed/mbed-os.git
Fix potentially overrunning write of sprintf
Format string "%d" requires 12 bytes (including the null terminator). Also, use snprintf instead of sprintf to prevent buffer overflow.pull/15404/head
parent
d0ca14e4fe
commit
c958d1d5b9
|
@ -186,8 +186,8 @@ retry_open:
|
|||
}
|
||||
}
|
||||
if (strcmp(paramTag, "conId") == 0) {
|
||||
char buf[10];
|
||||
std::sprintf(buf, "%d", _cid);
|
||||
char buf[12];
|
||||
std::snprintf(buf, sizeof(buf), "%d", _cid);
|
||||
if (strcmp(paramValue, buf) == 0) {
|
||||
foundConIdType = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue