lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV Volatile getenv Buffer


From: pg
Subject: LYNX-DEV Volatile getenv Buffer
Date: Wed, 21 Jan 1998 22:36:38 -0700 (MST)

Hello, Lyncei,

The string value returned by getenv is subject to overwriting by
subsequent calls to getenv.  I just encountered this on OS/390.
Here's a patch that fixes it for Home_Dir.  I suspect but haven't
verified a similar problem with $DISPLAY.

-- gil
================================================================
diff -rc ./orig/lynxsrc/src/LYUtils.c ./lynxsrc/src/LYUtils.c
*** ./orig/lynxsrc/src/LYUtils.c        Sun Jan 18 11:26:01 1998
--- ./lynxsrc/src/LYUtils.c     Wed Jan 21 22:19:17 1998
***************
*** 4640,4646 ****
      static CONST char *homedir = NULL;
  
      if (!homedir) {
!       if ((homedir = getenv("HOME")) == NULL) {
  #ifdef VMS
            if ((homedir = getenv("SYS$LOGIN")) == NULL) {
                if ((homedir = getenv("SYS$SCRATCH")) == NULL)
--- 4640,4651 ----
      static CONST char *homedir = NULL;
  
      if (!homedir) {
!       if ((homedir = getenv("HOME"))) {
!             char *work = NULL;
! 
!             StrAllocCopy(work, homedir);
!             homedir = work;
!         } else {
  #ifdef VMS
            if ((homedir = getenv("SYS$LOGIN")) == NULL) {
                if ((homedir = getenv("SYS$SCRATCH")) == NULL)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]