olsrd: security fixes for olsrd plugins
[feed/routing.git] / olsrd / patches / 003-hotfix-long-http-headers-json.patch
1 commit 528176910ee1d00278e4108cc23d9f4f2de8a639
2 Author: Alessio Caiazza <nolith@abisso.org>
3 Date: Wed May 14 22:45:33 2014 +0200
4
5 Hotfix for very long http headers also for jsoninfo
6
7 diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c b/lib/jsoninfo/src/olsrd_jsoninfo.c
8 index 966292c..817c64a 100644
9 --- a/lib/jsoninfo/src/olsrd_jsoninfo.c
10 +++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
11 @@ -508,8 +508,15 @@ ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int flags __att
12 FD_ZERO(&rfds);
13 FD_SET((unsigned int)ipc_connection, &rfds); /* Win32 needs the cast here */
14 if (0 <= select(ipc_connection + 1, &rfds, NULL, NULL, &tv)) {
15 - char requ[128];
16 - ssize_t s = recv(ipc_connection, (void *)&requ, sizeof(requ), 0); /* Win32 needs the cast here */
17 + char requ[1024];
18 + ssize_t s = recv(ipc_connection, (void *)&requ, sizeof(requ)-1, 0); /* Win32 needs the cast here */
19 +
20 + if (s == sizeof(requ)-1) {
21 + /* input was too much long, just skip the rest */
22 + char dummy[1024];
23 +
24 + while (recv(ipc_connection, (void *)&dummy, sizeof(dummy), 0) == sizeof(dummy), 0);
25 + }
26 if (0 < s) {
27 requ[s] = 0;
28 /* print out the requested tables */