diff options
| author | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2014-07-23 19:07:38 -0700 |
|---|---|---|
| committer | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2014-07-23 19:07:38 -0700 |
| commit | fde7be5151f7db096610cb59ca964e22e6af79fb (patch) | |
| tree | f4bdecbe240522b0ea8ed81f74d6c3c75dc88b10 | |
| parent | 0c63a8feb3c52de98a5da51a0a0f743450c34645 (diff) | |
| download | xrdp-proprietary-fde7be5151f7db096610cb59ca964e22e6af79fb.tar.gz xrdp-proprietary-fde7be5151f7db096610cb59ca964e22e6af79fb.zip | |
coverity: fixed issue argument cannot be negative
| -rw-r--r-- | sesman/chansrv/devredir.c | 2 | ||||
| -rw-r--r-- | sesman/tools/dis.c | 7 | ||||
| -rw-r--r-- | xrdpapi/xrdpapi.c | 6 |
3 files changed, 12 insertions, 3 deletions
diff --git a/sesman/chansrv/devredir.c b/sesman/chansrv/devredir.c index 121c1190..5a8ab3ed 100644 --- a/sesman/chansrv/devredir.c +++ b/sesman/chansrv/devredir.c @@ -118,7 +118,7 @@ dev_redir_init(void) } u; /* get a random number that will act as a unique clientID */ - if ((fd = open("/dev/urandom", O_RDONLY))) + if ((fd = open("/dev/urandom", O_RDONLY)) != -1) { if (read(fd, u.buf, 4) != 4) { diff --git a/sesman/tools/dis.c b/sesman/tools/dis.c index adcc3ee0..a21fbac4 100644 --- a/sesman/tools/dis.c +++ b/sesman/tools/dis.c @@ -58,7 +58,12 @@ int main(int argc, char **argv) return 1; } - sck = socket(PF_UNIX, SOCK_DGRAM, 0); + if ((sck = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) + { + printf("socket open error\n"); + return 1; + } + len = sizeof(sa); if (sendto(sck, "sig", 4, 0, (struct sockaddr *)&sa, len) > 0) diff --git a/xrdpapi/xrdpapi.c b/xrdpapi/xrdpapi.c index 23630804..9310f6f8 100644 --- a/xrdpapi/xrdpapi.c +++ b/xrdpapi/xrdpapi.c @@ -124,7 +124,11 @@ WTSVirtualChannelOpenEx(unsigned int SessionId, const char *pVirtualName, } /* we use unix domain socket to communicate with chansrv */ - wts->fd = socket(AF_UNIX, SOCK_STREAM, 0); + if ((wts->fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + { + g_free(wts); + return NULL; + } /* set non blocking */ llong = fcntl(wts->fd, F_GETFL); |
