]> arthur.barton.de Git - netatalk.git/commitdiff
Fix a potential buffer overflow. Thanks to didier <dgautheron@magic.fr>.
authorjmarcus <jmarcus>
Thu, 24 Jan 2002 16:32:12 +0000 (16:32 +0000)
committerjmarcus <jmarcus>
Thu, 24 Jan 2002 16:32:12 +0000 (16:32 +0000)
etc/afpd/enumerate.c

index 85322e1d26aefc5e53dc52efe781455ccdddddb3..61e98a15403183c5ae5bbe2fbdd2a91bc52d05a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: enumerate.c,v 1.14 2002-01-17 16:19:07 jmarcus Exp $
+ * $Id: enumerate.c,v 1.15 2002-01-24 16:32:12 jmarcus Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -39,6 +39,8 @@
 #include "parse_mtab.h"
 #endif /* DID_MTAB */
 
+#define min(a,b)       ((a)<(b)?(a):(b))
+
 struct dir *
             adddir( vol, dir, name, namlen, upath, upathlen, st )
             struct vol *vol;
@@ -217,6 +219,8 @@ int         ibuflen, *rbuflen;
     maxsz = ntohs( maxsz );
     ibuf += sizeof( maxsz );
 
+    maxsz = min(maxsz, *rbuflen);
+
     if (( path = cname( vol, dir, &ibuf )) == NULL ) {
         *rbuflen = 0;
         return( AFPERR_NODIR );