home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / bugs / sys5 / 144 next >
Encoding:
Text File  |  1992-12-11  |  1.6 KB  |  42 lines

  1. Newsgroups: comp.bugs.sys5
  2. Path: sparky!uunet!rei2!rick
  3. From: rick@rei.com (Richard J. Barton)
  4. Subject: Re: putenv() is clobbering static data! NCR 3xxx NCR OS 2.0 (SVR4)
  5. Message-ID: <1992Dec11.164336.11037@rei.com>
  6. Date: Fri, 11 Dec 1992 16:43:36 GMT
  7. References: <1992Dec9.091253.26269@informix.com>
  8. Organization: Recognition Equipment, Inc.
  9. Lines: 31
  10.  
  11. aland@informix.com (Colonel Panic) writes:
  12.  
  13. >I've run into a nasty bug on NCR, but I can't yet be sure whether this
  14. >is a USL-generic thing or NCR-specific.
  15.  
  16. >The scenario: I have a socket-accepting daemon that forks children for
  17. >each new accepted connection over an RF link.  Pretty basic stuff.
  18. >At one point, I call putenv() to replace PATH in the user's environment
  19. >(a security measure; long story).  I assemble my new variable into a 
  20. >(static) character buffer declared above main (*not* an automatic
  21. >variable, I'm not *quite* that punchy yet), call putenv(), putenv()
  22. >returns zero, AND CLOBBERS MY SOCKET HANDLE! (a (static) int). 
  23. >What was (5) becomes (1835413345) as an immediate result of the putenv().  
  24. >The string being putenv'd is about 340 bytes long.  I don't know yet 
  25. >if anything else gets clobbered.
  26.  
  27. >All of this works fine on Sun and HP/UX (among others), but this is
  28. >the first SVR4 we've tried it on.    
  29.  
  30. >Any ideas out there?
  31.  
  32. You may want to check the amount of combination argv, envp string space
  33. that's being used.  Then look at the kernel parameter ARG_MAX (usually
  34. defaults to about 5K).  If you're repetitively doing putenv() this may
  35. be a problem.  This is just a hunch...
  36.  
  37. -- 
  38. rick
  39. :-)
  40. rick@panic.com [Personal]
  41. rick@rei.com   [Plexus Software, A Division of Recognition Equipment Inc.]
  42.