Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/lib/libsa/minixfs3.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/lib/libsa/minixfs3.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.7 retrieving revision 1.8 diff -u -p -r1.7 -r1.8 --- src/sys/lib/libsa/minixfs3.c 2014/03/20 03:13:18 1.7 +++ src/sys/lib/libsa/minixfs3.c 2019/03/31 20:08:45 1.8 @@ -1,4 +1,4 @@ -/* $NetBSD: minixfs3.c,v 1.7 2014/03/20 03:13:18 christos Exp $ */ +/* $NetBSD: minixfs3.c,v 1.8 2019/03/31 20:08:45 christos Exp $ */ /*- * Copyright (c) 2012 @@ -122,6 +122,7 @@ #ifdef _STANDALONE #include #else +#include #include #endif @@ -341,7 +342,7 @@ buf_read_file(struct open_file *f, void long off; block_t file_block; block_t disk_block = 0; /* XXX: gcc */ - size_t block_size; + size_t block_size, nsz; int rc; off = mfs_blkoff(fs, fp->f_seekp); @@ -379,8 +380,9 @@ buf_read_file(struct open_file *f, void /* * But truncate buffer at end of file. */ - if (*size_p > fp->f_di.mdi_size - fp->f_seekp) - *size_p = fp->f_di.mdi_size - fp->f_seekp; + nsz = (size_t)(fp->f_di.mdi_size - fp->f_seekp); + if (*size_p > nsz) + *size_p = nsz; return 0; }