diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/main.c | 12 |
2 files changed, 13 insertions, 3 deletions
@@ -1,5 +1,9 @@ 2013-11-27 + * src/main.c: check the return value of fd_gets(). + +2013-11-27 + * libsylph/html.c: html_unescape_str(): strictly check for utf8 length. 2013-11-27 @@ -1553,7 +1553,7 @@ static gint prohibit_duplicate_launch(void) } fd_write_all(sock, ".\n", 2); for (;;) { - fd_gets(sock, buf, sizeof(buf)); + if (fd_gets(sock, buf, sizeof(buf)) <= 0) break; if (!strncmp(buf, ".\n", 2)) break; fputs(buf, stdout); } @@ -1613,7 +1613,7 @@ static GPtrArray *get_folder_item_list(gint sock) GPtrArray *folders = NULL; for (;;) { - fd_gets(sock, buf, sizeof(buf)); + if (fd_gets(sock, buf, sizeof(buf)) <= 0) break; if (!strncmp(buf, ".\n", 2)) break; strretchomp(buf); if (!folders) folders = g_ptr_array_new(); @@ -1640,7 +1640,13 @@ static gboolean lock_socket_input_cb(GIOChannel *source, GIOCondition condition, fd = g_io_channel_unix_get_fd(source); sock = fd_accept(fd); - fd_gets(sock, buf, sizeof(buf)); + if (fd_gets(sock, buf, sizeof(buf)) <= 0) { + fd_close(sock); +#if USE_THREADS + gdk_threads_leave(); +#endif + return TRUE; + } if (!strncmp(buf, "popup", 5)) { #ifdef G_OS_WIN32 |