delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/04/11:17:31

Message-Id: <5.1.0.14.0.20010804111223.02918ec0@pop.dorsai.org>
X-Sender: pjfarley AT pop DOT dorsai DOT org
X-Mailer: QUALCOMM Windows Eudora Version 5.1
Date: Sat, 04 Aug 2001 11:22:11 -0400
To: djgpp-workers AT delorie DOT com
From: "Peter J. Farley III" <pjfarley AT dorsai DOT org>
Subject: Re: Bash 2.05 buffer overrun problem
Cc: snowball3 AT bigfoot DOT com, "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>,
sandmann AT clio DOT rice DOT edu, acottrel AT ihug DOT com DOT au
In-Reply-To: <9003-Sat04Aug2001143940+0300-eliz@is.elta.co.il>
References: <00cb01c11ccc$ef2fadf0$0a02a8c0 AT acceleron>
<00cb01c11ccc$ef2fadf0$0a02a8c0 AT acceleron>
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

PMFJI here, but on my Win98SE system, this is the response I get from 
entering "command /?" on a DOS box (word-wrapped lines were adjusted 
manually, sorry if it still wraps when you see it):

Microsoft(R) Windows 98
    (C)Copyright Microsoft Corp 1981-1999.

C:\>command /?
Starts a new copy of the Windows Command Interpreter.

COMMAND [[drive:]path] [device] [/E:nnnnn] [/L:nnnn] [/U:nnn] [/P]
         [/MSG] [/LOW] [/Y [/[C|K] command]]
   [drive:]path Specifies the directory containing COMMAND.COM.
   device       Specifies the device to use for command input and 
output.
   /E:nnnnn     Sets the initial environment size to nnnnn bytes.
                (nnnnn should be between 256 and 32,768).
   /L:nnnn      Specifies internal buffers length (requires /P as 
well).
                (nnnn should be between 128 and 1,024).
   /U:nnn       Specifies the input buffer length (requires /P as 
well).
                (nnn should be between 128 and 255).
   /P           Makes the new Command Interpreter permanent (can't 
exit).
   /MSG      Stores all error messages in memory (requires /P as well).
   /LOW         Forces COMMAND to keep its resident data in low memory.
   /Y           Steps through the batch program specified by /C or /K.
   /C command   Executes the specified command and returns.
   /K command   Executes the specified command and continues running.

Note that the ENVIRONMENT size (/E:) is allowed to be up to 32768.  I 
think that is the size you need to allow for.  Though personally I've 
never used more than 1024, there's no telling what someone else might 
choose to use.

What does "command /?" report on W2K?

HTH

Peter

At 02:39 PM 8/4/01 +0300, Eli Zaretskii wrote:
 >> From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
 >> Date: Sat, 4 Aug 2001 20:05:03 +1000
 >>
 >> The quick workarround I have done in the source that I am using is 
to
 >add
 >> another buffer after the path_buffer.
 >>     static char path_buffer[256];
 >>     static char overrun_buffer[4096]; /* path_buffer is to small */
 >>     static char *init_cwd;
 >
 >I think 256 characters is not enough even on Windows 9X: IIRC, the
 >limitation on environment variables on Windows 9X is 1024 characters.
 >
 >Bash should probably use alloca instead of a static arbitrary limit.
At 02:39 PM 8/4/01 +0300, Eli Zaretskii wrote:
 >> From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
 >> Date: Sat, 4 Aug 2001 20:05:03 +1000
 >>
 >> The quick workarround I have done in the source that I am using is 
to
 >add
 >> another buffer after the path_buffer.
 >>     static char path_buffer[256];
 >>     static char overrun_buffer[4096]; /* path_buffer is to small */
 >>     static char *init_cwd;
 >
 >I think 256 characters is not enough even on Windows 9X: IIRC, the
 >limitation on environment variables on Windows 9X is 1024 characters.
 >
 >Bash should probably use alloca instead of a static arbitrary limit.

---------------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org OR
                      pjfarley3 AT escape DOT com)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019