From 78fe8216941a8d0f6fb6b9259d8b0f4ed70978d4 Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland@gnu.org>
Date: Thu, 14 Oct 1999 01:19:08 +0000
Subject: 1999-10-13  Roland McGrath  <roland@baalperazim.frob.com>

	* lookup.c (diskfs_lookup): Enforce diskfs_name_max limit for CREATE
	and RENAME, returning ENAMETOOLONG for violations.
	* io-pathconf.c (diskfs_S_io_pathconf): _PC_NO_TRUNC controlled by
	diskfs_name_max setting.
---
 libdiskfs/lookup.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'libdiskfs/lookup.c')

diff --git a/libdiskfs/lookup.c b/libdiskfs/lookup.c
index 10419f51..d81a053e 100644
--- a/libdiskfs/lookup.c
+++ b/libdiskfs/lookup.c
@@ -204,9 +204,12 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type,
 	{
 	  error_t err2;
 
-	  err2 = fshelp_checkdirmod (&dp->dn_stat,
-				     (err || !np) ? 0 : &(*np)->dn_stat,
-				     cred->user);
+	  if (diskfs_name_max > 0 && strlen (name) > diskfs_name_max)
+	    err2 = ENAMETOOLONG;
+	  else
+	    err2 = fshelp_checkdirmod (&dp->dn_stat,
+				       (err || !np) ? 0 : &(*np)->dn_stat,
+				       cred->user);
 	  if (err2)
 	    {
 	      if (np && !err)
-- 
cgit v1.2.3