diff options
| author | Heiko Carstens <hca@linux.ibm.com> | 2025-10-07 11:05:05 +0200 |
|---|---|---|
| committer | Heiko Carstens <hca@linux.ibm.com> | 2025-10-21 10:17:30 +0200 |
| commit | c97689345cd0613f8c8c81c3304331fbd2c5b599 (patch) | |
| tree | 2351438450ea9a8e872b2c79ce524254ecc7bea1 | |
| parent | c769941de8bf6ab744bbc7ec7a88c32955d10646 (diff) | |
| download | linux-c97689345cd0613f8c8c81c3304331fbd2c5b599.tar.gz linux-c97689345cd0613f8c8c81c3304331fbd2c5b599.zip | |
s390/con3270: Use scnprintf() instead of sprintf()
Use scnprintf() instead of sprintf() for those cases where the destination
is an array and the size of the array is known at compile time.
This prevents theoretical buffer overflows, but also avoids that people
again and again spend time to figure out if the code is actually safe.
Reviewed-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
| -rw-r--r-- | drivers/s390/char/con3270.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c index a367f95c7c53..5a505972e571 100644 --- a/drivers/s390/char/con3270.c +++ b/drivers/s390/char/con3270.c @@ -1662,7 +1662,7 @@ static void tty3270_escape_sequence(struct tty3270 *tp, u8 ch) else if (tp->esc_par[0] == 6) { /* Cursor report. */ char buf[40]; - sprintf(buf, "\033[%d;%dR", tp->cy + 1, tp->cx + 1); + scnprintf(buf, sizeof(buf), "\033[%d;%dR", tp->cy + 1, tp->cx + 1); kbd_puts_queue(&tp->port, buf); } return; |
