0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

Do not let reading from /dev/stdin and /dev/fd/0.

This commit is contained in:
Witold Filipczyk 2007-03-13 22:09:41 +01:00 committed by Witold Filipczyk
parent a494f376f9
commit 7ab5b8d57e

View File

@ -213,8 +213,16 @@ read_special(struct connection *conn, int fd)
abort_connection(conn, S_OUT_OF_MEM);
return;
}
if (isatty(fd)) {
abort_connection(conn, S_OK);
return;
}
if (fd != STDIN_FILENO)
conn->popen = 1;
conn->socket->fd = fd;
if (fd != STDIN_FILENO) conn->popen = 1;
rb = alloc_read_buffer(conn->socket);
if (!rb) {
abort_connection(conn, S_OUT_OF_MEM);
@ -291,7 +299,7 @@ file_protocol_handler(struct connection *connection)
if (!strncmp(name.source, "/dev/fd/", 8)) {
int fd = atoi(name.source + 8);
if (fd > 0) {
if (fd >= 0) {
done_string(&name);
read_special(connection, fd);
return;