mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user