sys-block/seekwatcher: Drop old
[gentoo.git] / sys-cluster / ganglia / files / ganglia-3.1.1-process_path-overflow-r1.patch
1 Index: gmetad/server.c
2 ===================================================================
3 --- gmetad/server.c     (revision 1953)
4 +++ gmetad/server.c     (working copy)
5 @@ -370,14 +370,13 @@
6     
7  /* sacerdoti: This function does a tree walk while respecting the filter path.
8   * Will return valid XML even if we have chosen a subtree. Since tree depth is
9 - * bounded, this function guarantees O(1) search time. The recursive structure 
10 - * does not require any memory allocations. 
11 + * bounded, this function guarantees O(1) search time.
12   */
13  static int
14  process_path (client_t *client, char *path, datum_t *myroot, datum_t *key)
15  {
16     char *p, *q, *pathend;
17 -   char element[256];
18 +   char *element;
19     int rc, len;
20     datum_t *found;
21     datum_t findkey;
22 @@ -419,6 +418,9 @@
23           if (!q) q=pathend;
24        
25           len = q-p;
26 +         element = malloc(len + 1);
27 +         if ( element == NULL )
28 +             return 1;
29           strncpy(element, p, len);
30           element[len] = '\0';
31        
32 @@ -440,6 +442,7 @@
33              {
34                 rc = process_path(client, 0, myroot, NULL);
35              }
36 +         free(element);
37        }
38     if (rc) return 1;
39  
40 @@ -537,7 +540,7 @@
41     socklen_t len;
42     client_t client;
43     char remote_ip[16];
44 -   char request[REQUESTLEN];
45 +   char request[REQUESTLEN + 1];
46     llist_entry *le;
47     datum_t rootdatum;
48