Subject: MSDOSFS: Bug in unix2dosfn()
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Mike Hartman <mikeh@hds.com>
List: netbsd-bugs
Date: 08/29/1994 17:16:58
File:		msdosfs_conv.c
Function:	unix2dosfn()
Problem:	unix2dosfn() does not update the filename length when
		skipping over the '.' character.


Michael Hartman			  |
Software Engineer		  | Internet: mikeh@hds.com
Human Designed Systems, Inc.	  |
421 Feheley Drive		  | phone:    (610) 277-8300
King of Prussia, PA 19406  (USA)  | FAX:      (610) 275-5739
----------------------------------------------------------------


Sample fix:


*** msdosfs_conv.c	Fri Aug 19 09:32:38 1994
--- msdosfs_conv.c	Mon Aug 29 17:08:35 1994
***************
*** 331,344 ****
  		un++;
  		unlen--;
  	}
  
  	/*
  	 * If we stopped on a '.', then get past it.
  	 */
! 	if (c == '.')
  		un++;
  
  	/*
  	 * Copy in the extension part of the name, if any. Force to upper
  	 * case. Note that the extension is allowed to contain '.'s.
  	 * Filenames in this form are probably inaccessable under dos.
--- 331,352 ----
  		un++;
  		unlen--;
  	}
  
  	/*
+ 	 * Check if we are done.
+ 	 */
+ 	if (!unlen)
+ 		return;
+ 
+ 	/*
  	 * If we stopped on a '.', then get past it.
  	 */
! 	if (c == '.') {
  		un++;
+ 		unlen--;
+ 	}
  
  	/*
  	 * Copy in the extension part of the name, if any. Force to upper
  	 * case. Note that the extension is allowed to contain '.'s.
  	 * Filenames in this form are probably inaccessable under dos.


------------------------------------------------------------------------------