mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* direntry.c (vfs_s_get_line): Fix off-by-one buffer overflow.
This commit is contained in:
parent
9a36e62af2
commit
1c411834a8
@ -1,5 +1,7 @@
|
||||
2002-08-19 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* direntry.c (vfs_s_get_line): Fix off-by-one buffer overflow.
|
||||
|
||||
* fish.c (pipeopen): Use _exit(), not vfs_die() to terminate the
|
||||
child if execvp() fails.
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ vfs_s_get_line (vfs *me, int sock, char *buf, int buf_len, char term)
|
||||
int i, status;
|
||||
char c;
|
||||
|
||||
for (i = 0; i < buf_len; i++, buf++){
|
||||
for (i = 0; i < buf_len - 1; i++, buf++){
|
||||
if (read (sock, buf, sizeof(char)) <= 0)
|
||||
return 0;
|
||||
if (logfile){
|
||||
@ -1146,6 +1146,8 @@ vfs_s_get_line (vfs *me, int sock, char *buf, int buf_len, char term)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Line is too long - terminate buffer and discard the rest of line */
|
||||
*buf = 0;
|
||||
while ((status = read (sock, &c, sizeof (c))) > 0){
|
||||
if (logfile){
|
||||
|
Loading…
Reference in New Issue
Block a user