diff options
Diffstat (limited to 'src/ipcpd')
| -rw-r--r-- | src/ipcpd/normal/dht.c | 3 | ||||
| -rw-r--r-- | src/ipcpd/normal/pol/graph.c | 5 | ||||
| -rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 6 | ||||
| -rw-r--r-- | src/ipcpd/shim-udp/main.c | 6 | 
4 files changed, 11 insertions, 9 deletions
| diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c index b5d52d93..b5bac913 100644 --- a/src/ipcpd/normal/dht.c +++ b/src/ipcpd/normal/dht.c @@ -745,7 +745,8 @@ static void lookup_update(struct dht *    dht,                  } else {                          struct contact * d;                          list_add_tail(&c->next, p); -                        d = list_last_entry(&lu->contacts, struct contact, next); +                        d = list_last_entry(&lu->contacts, +                                            struct contact, next);                          list_del(&d->next);                          contact_destroy(d);                  } diff --git a/src/ipcpd/normal/pol/graph.c b/src/ipcpd/normal/pol/graph.c index 3611f0b0..9901fbaa 100644 --- a/src/ipcpd/normal/pol/graph.c +++ b/src/ipcpd/normal/pol/graph.c @@ -454,9 +454,10 @@ ssize_t graph_routing_table(struct graph *           graph,          pthread_mutex_lock(&graph->lock); -        if (graph->nr_vertices == 0) { +        /* We need at least 2 vertices for a table */ +        if (graph->nr_vertices < 2) {                  pthread_mutex_unlock(&graph->lock); -                return 0; +                return -1;          }          prevs = dijkstra(graph, s_addr); diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 3d186d7a..e5f0cba8 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -166,11 +166,13 @@ static int eth_llc_data_init(void)          int                ret = -ENOMEM;          pthread_condattr_t cattr; -        eth_llc_data.fd_to_ef = malloc(sizeof(struct ef) * SYS_MAX_FLOWS); +        eth_llc_data.fd_to_ef = +                malloc(sizeof(*eth_llc_data.fd_to_ef) * SYS_MAX_FLOWS);          if (eth_llc_data.fd_to_ef == NULL)                  goto fail_fd_to_ef; -        eth_llc_data.ef_to_fd = malloc(sizeof(struct ef) * MAX_SAPS); +        eth_llc_data.ef_to_fd = +                malloc(sizeof(*eth_llc_data.ef_to_fd) * MAX_SAPS);          if (eth_llc_data.ef_to_fd == NULL)                  goto fail_ef_to_fd; diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 0bf57741..b6f516bd 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -693,10 +693,8 @@ static uint32_t ddns_resolve(char *   name,          char * addr_str = "Address:";          uint32_t ip_addr = 0; -        if (inet_ntop(AF_INET, &dns_addr, dnsstr, INET_ADDRSTRLEN) == NULL) { +        if (inet_ntop(AF_INET, &dns_addr, dnsstr, INET_ADDRSTRLEN) == NULL)                  return 0; -        } -          if (pipe(pipe_fd)) {                  log_err("Failed to create pipe."); @@ -743,7 +741,7 @@ static uint32_t ddns_resolve(char *   name,                  substr = strtok(NULL, "\n");          } -        if (strstr(substr2, addr_str) == NULL) { +        if (substr2 == NULL || strstr(substr2, addr_str) == NULL) {                  log_err("Failed to resolve DNS address.");                  return 0;          } | 
