[Libsysio-commit] HEAD: libsysio/src rw.c
Brought to you by:
lward
From: Sonja T. <so...@us...> - 2004-08-13 14:40:18
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7514/src Modified Files: rw.c Log Message: Removed definition of MAX_IOVEC from fs_native.c Fixed ireadx to verify the iov_counts and xtv_counts are valid Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- rw.c 27 Jul 2004 15:00:48 -0000 1.12 +++ rw.c 13 Aug 2004 14:40:09 -0000 1.13 @@ -682,9 +682,18 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ireadx)) SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + +#ifdef MAX_IOVEC + if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); +#endif + err = _sysio_iiox(IIOXOP_READ(fil->f_ino), fil, @@ -717,9 +726,20 @@ SYSIO_INTERFACE_NAME(ireadx)(int fd, SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + +#ifdef MAX_IOVEC + if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); +#endif + + ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); if (!ixtv) SYSIO_INTERFACE_RETURN(IOID_FAIL, -ENOMEM); |