diff options
author | 2001-05-06 21:23:31 +0000 | |
---|---|---|
committer | 2001-05-06 21:23:31 +0000 | |
commit | 4e8957f8684fa200278c0779dc55e000673e2d4c (patch) | |
tree | 6dd77c19a33b7f059536aea750d3d5bb0b1fc858 /usr.bin/ssh/cli.c | |
parent | Use const for 'prompt'. Brought over from portable tree. (diff) | |
download | wireguard-openbsd-4e8957f8684fa200278c0779dc55e000673e2d4c.tar.xz wireguard-openbsd-4e8957f8684fa200278c0779dc55e000673e2d4c.zip |
cli_read() fails to catch SIGINT + overflow; from obdb@zzlevo.net
Diffstat (limited to 'usr.bin/ssh/cli.c')
-rw-r--r-- | usr.bin/ssh/cli.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/ssh/cli.c b/usr.bin/ssh/cli.c index 7fe705742fa..7cd6bbf4b36 100644 --- a/usr.bin/ssh/cli.c +++ b/usr.bin/ssh/cli.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cli.c,v 1.12 2001/05/06 17:52:07 mouring Exp $ */ +/* $OpenBSD: cli.c,v 1.13 2001/05/06 21:23:31 markus Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. @@ -25,7 +25,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: cli.c,v 1.12 2001/05/06 17:52:07 mouring Exp $"); +RCSID("$OpenBSD: cli.c,v 1.13 2001/05/06 21:23:31 markus Exp $"); #include "xmalloc.h" #include "log.h" @@ -143,15 +143,19 @@ cli_read(char* buf, int size, int echo) while (ch != '\n') { n = read(cli_input, &ch, 1); + if (intr) + break; if (n == -1 && (errno == EAGAIN || errno == EINTR)) continue; if (n != 1) break; - if (ch == '\n' || intr != 0) + if (ch == '\n') break; - if (i < size) + if (i < size - 1) buf[i++] = ch; } + if (intr) + i = 0; buf[i] = '\0'; if (!echo) |