diff options
| author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-05-15 11:51:52 +0200 | 
|---|---|---|
| committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-05-15 11:51:52 +0200 | 
| commit | 810fb7625b00298ec6c36e9aa291d2fda54bf506 (patch) | |
| tree | 4b0a50e3f53b33095fbfd850cb6bd881fe361604 | |
| parent | bc94dd6436a62bda6bf3ba11a20dbc50f7094e5a (diff) | |
| download | ouroboros-810fb7625b00298ec6c36e9aa291d2fda54bf506.tar.gz ouroboros-810fb7625b00298ec6c36e9aa291d2fda54bf506.zip | |
ipcpd: shim-udp: added missing checks
| -rw-r--r-- | src/ipcpd/shim-udp/main.c | 20 | 
1 files changed, 10 insertions, 10 deletions
| diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 2d1691aa..9c295e30 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -196,10 +196,8 @@ static int port_id_to_fd(int port_id)          for (i = 0; i < AP_MAX_FLOWS; ++i) {                  if (_ap_instance->flows[i].port_id == port_id -                    && _ap_instance->flows[i].state != FLOW_NULL) { - +                    && _ap_instance->flows[i].state != FLOW_NULL)                          return i; -                }          }          return -1; @@ -457,15 +455,17 @@ static void * ipcp_udp_sdu_reader()                                  continue;                          n = sizeof r_saddr; -                        n = recvfrom(fd, -                                     buf, -                                     SHIM_UDP_MAX_SDU_SIZE, -                                     0, -                                     (struct sockaddr *) &r_saddr, -                                     (unsigned *) &n); +                        if ((n = recvfrom(fd, +                                          buf, +                                          SHIM_UDP_MAX_SDU_SIZE, +                                          0, +                                          (struct sockaddr *) &r_saddr, +                                          (unsigned *) &n)) <= 0) +                                continue;                          /* send the sdu to the correct port_id */ -                        ipcp_udp_flow_write(fd, buf, n); +                        if (ipcp_udp_flow_write(fd, buf, n) < 0) +                                LOG_ERR("Failed to write SDU.");                  }          } | 
