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