summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-02-25 09:52:46 +0000
committerimp <imp@FreeBSD.org>1999-02-25 09:52:46 +0000
commitf6b1037575373d7a052a12a6b64e3138281c360d (patch)
treefb8fa0b8435f3baff5efd12d092f65f0d9be30af /sys/ufs
parent9ef78c728610496319622acd1b0dd83572341e62 (diff)
downloadFreeBSD-src-f6b1037575373d7a052a12a6b64e3138281c360d.zip
FreeBSD-src-f6b1037575373d7a052a12a6b64e3138281c360d.tar.gz
Add missing check for LINK_MAX in ufs_rename. Since ip->i_effnlink and
ip->nlink were different types, there was a masked overflow. Reported by: Mark Slemco <marcs@znep.com>
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_vnops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 4c9c426..7169e65 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
- * $Id: ufs_vnops.c,v 1.107 1999/02/13 08:38:28 dillon Exp $
+ * $Id: ufs_vnops.c,v 1.108 1999/02/25 05:35:53 dillon Exp $
*/
#include "opt_quota.h"
@@ -1017,6 +1017,10 @@ abortit:
* completing our work, the link count
* may be wrong, but correctable.
*/
+ if (ip->i_nlink >= LINK_MAX) {
+ error = EMLINK;
+ goto bad;
+ }
ip->i_effnlink++;
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
OpenPOWER on IntegriCloud