Subject: bin/1868: modload bug in checking for .o extension
To: None <gnats-bugs@gnats.netbsd.org>
From: None <explorer@flame.org>
List: netbsd-bugs
Date: 12/30/1995 03:48:38
>Number:         1868
>Category:       bin
>Synopsis:       modload bug in checking for .o extension
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 30 05:05:01 1995
>Last-Modified:
>Originator:     Michael Graff
>Organization:
flame.org:  yes, we do know everything
>Release:        1.1
>Environment:
	
System: NetBSD packrat.flame.org 1.1A NetBSD 1.1A (PACKRAT) #0: Wed Dec 27 19:40:47 CST 1995 explorer@packrat.flame.org:/usr/src/sys/arch/i386/compile/PACKRAT i386


>Description:
modload uses strchr() to find the first period in the string. However, names
like xf86.aperture.o will fail, since it finds the first period and compares
this to .o, which is just plain wrong.
	
>How-To-Repeat:
call a module foo.bar.o (it need not even exist) and try to modload it.
	
>Fix:
	

Apply this short patch:

*** modload.c.sma	Sat Dec 30 03:42:22 1995
--- modload.c	Sat Dec 30 03:42:55 1995
***************
*** 208,214 ****
  
  	strcpy(modout, modobj);
  
! 	p = strchr(modout, '.');
  	if (!p || strcmp(p, ".o"))
  		errx(2, "module object must end in .o");
  	if (out == NULL) {
--- 208,214 ----
  
  	strcpy(modout, modobj);
  
! 	p = strrchr(modout, '.');
  	if (!p || strcmp(p, ".o"))
  		errx(2, "module object must end in .o");
  	if (out == NULL) {
>Audit-Trail:
>Unformatted: