Revision 1d82dff0

View differences:

som/net_helper.c
129 129

  
130 130
int nodeid_dump(uint8_t *b, const struct nodeID *s)
131 131
{
132
  memcpy(b, s, sizeof(struct nodeID));
132
  memcpy(b, &s->addr, sizeof(struct sockaddr_in));
133 133

  
134
  return sizeof(struct nodeID);
134
  return sizeof(struct sockaddr_in);
135 135
}
136 136

  
137 137
struct nodeID *nodeid_undump(const uint8_t *b, int *len)
......
139 139
  struct nodeID *res;
140 140
  res = malloc(sizeof(struct nodeID));
141 141
  if (res != NULL) {
142
    memcpy(res, b, sizeof(struct nodeID));
142
    memcpy(&res->addr, b, sizeof(struct sockaddr_in));
143 143
  }
144
  *len = sizeof(struct nodeID);
144
  *len = sizeof(struct sockaddr_in);
145 145

  
146 146
  return res;
147 147
}

Also available in: Unified diff