avoid crash if attempting to truncate to a negative length (from mycroft)
authorMarshall Kirk McKusick <mkm@ucbvax.Berkeley.EDU>
Thu, 16 Jun 1994 07:32:13 +0000 (23:32 -0800)
committerMarshall Kirk McKusick <mkm@ucbvax.Berkeley.EDU>
Thu, 16 Jun 1994 07:32:13 +0000 (23:32 -0800)
SCCS-vsn: sys/ufs/ffs/ffs_inode.c 8.7

usr/src/sys/ufs/ffs/ffs_inode.c

index 7a8eb14..6f431f4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ffs_inode.c 8.6 (Berkeley) %G%
+ *     @(#)ffs_inode.c 8.7 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -135,6 +135,8 @@ ffs_truncate(ap)
        int aflags, error, allerror;
        off_t osize;
 
        int aflags, error, allerror;
        off_t osize;
 
+       if (length < 0)
+               return (EINVAL);
        oip = VTOI(ovp);
        tv = time;
        if (ovp->v_type == VLNK &&
        oip = VTOI(ovp);
        tv = time;
        if (ovp->v_type == VLNK &&