Revision f5853f90

View differences:

som/ChunkBuffer/config.c
2 2
#include <string.h>
3 3
#include "config.h"
4 4

  
5
#define NAME_SIZE 32
6
#define VAL_SIZE 16
7

  
5 8
struct tag {
6
  char name[32];
7
  char value[16];
9
  char name[NAME_SIZE];
10
  char value[VAL_SIZE];
8 11
};
9 12

  
10 13
#define MAX_TAGS 16
......
22 25
  }
23 26
  while (p && *p != 0) {
24 27
    char *p1 = strchr(p, '=');
28
    
29
    memset(res[i].name, 0, NAME_SIZE);
30
    memset(res[i].value, 0, VAL_SIZE);
25 31
    if (p1) {
26 32
      if (i % MAX_TAGS == 0) {
27 33
        res = realloc(res, sizeof(struct tag) * (i + MAX_TAGS));
28 34
      }
29 35
      memcpy(res[i].name, p, p1 - p);
30
      res[i].name[p1 - p + 1] = 0;
31 36
      p = strchr(p1, ',');
32 37
      if (p == NULL) {
33 38
        strcpy(res[i++].value, p1 + 1);
......
40 45
      p = NULL;
41 46
    }
42 47
  }
43
  res[i++].name[0] = 0;
44 48

  
45 49
  res = realloc(res, sizeof(struct tag) * i);
46 50

  

Also available in: Unified diff