From: Philippe Waroquiers Date: Sun, 23 Dec 2018 13:49:25 +0000 (+0100) Subject: Fix 402395 coregrind/vgdb-invoker-solaris.c: 2 * poor error checking X-Git-Tag: VALGRIND_3_15_0~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59f0855049a125a92c84ef8a5e7874a5953a2cf9;p=thirdparty%2Fvalgrind.git Fix 402395 coregrind/vgdb-invoker-solaris.c: 2 * poor error checking 2 size_t variables were used as return value of read syscalls, while ssize_t must be used. --- diff --git a/NEWS b/NEWS index e1645eff08..18ee9d5948 100644 --- a/NEWS +++ b/NEWS @@ -74,6 +74,7 @@ where XXXXXX is the bug number as listed below. 402048 WARNING: unhandled ppc64[be|le]-linux syscall: 26 (ptrace) 402134 assertion fail in mc_translate.c (noteTmpUsesIn) Iex_VECRET on arm64 402327 Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x13 (DW_OP_drop) +402395 coregrind/vgdb-invoker-solaris.c: 2 * poor error checking Release 3.14.0 (9 October 2018) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/coregrind/vgdb-invoker-solaris.c b/coregrind/vgdb-invoker-solaris.c index 8185e704f9..b62902b950 100644 --- a/coregrind/vgdb-invoker-solaris.c +++ b/coregrind/vgdb-invoker-solaris.c @@ -173,8 +173,8 @@ static Bool attach(pid_t pid) } pstatus_t pstatus; - bytes = read(status_fd, &pstatus, sizeof(pstatus)); - if ((bytes < 0) || (bytes != sizeof(pstatus))) { + ssize_t nread = read(status_fd, &pstatus, sizeof(pstatus)); + if ((nread < 0) || (nread != sizeof(pstatus))) { ERROR(errno, "Failed to read from %s.\n", procname); close(status_fd); return False; @@ -400,8 +400,8 @@ static Bool invoke_agent(pid_t pid, prgregset_t *regs, id_t *agent_lwpid) } lwpstatus_t status; - bytes = read(status_fd, &status, sizeof(status)); - if ((bytes < 0) || (bytes != sizeof(status))) { + ssize_t nread = read(status_fd, &status, sizeof(status)); + if ((nread < 0) || (nread != sizeof(status))) { ERROR(errno, "Failed to read from %s.\n", procname); close(status_fd); return False;