1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Special Boundary Value 19998 for command line length

Discussion in 'T&T - Miscellaneous' started by fakoor, Apr 24, 2011.

  1. fakoor

    Apr 11, 2011
    Likes Received:
    I faced a strange situation while working with tcc.exe shell. I noticed that the commands larger than 19998 characters in length are executed but are not memorized in the history (When you press up arrow, it doesn't appear)

    On the other hand if the total length of command line is 19997 or less it will be both executed and memorized (and re-appear when you press up arrow).

    Finally, if the command line length is exactly 19998 characters, the shell will halt when executing that command and you will not be returned back to command prompt.

    For example executing the following command in which the last double-quotation mark is the 19998th character of the command will halt the shell:
    echo "AAAA....AAA"
    Note: A zip file containing a batch file consisting of the three examples mentioned above is attached. Please note that running the commands inside the batch file does not raise the halting issue.

    Attached Files:

  2. ebbe

    Jun 2, 2008
    Likes Received:
    Sorry, I have no solution for you. But you have piqued my interest beyond containment: what on earth are you doing that requires commands of such length?

    In all the years that I have used JPSoft products I have rarely managed to run into command line length limitations and then only in 4DOS where the limit was 1023 characters if I recall correctly.
  3. fakoor

    Apr 11, 2011
    Likes Received:
    Thanks for your reply and interest in this question.
    The case that lead me to need more command-line input buffer is described here in this thread.
  4. rconn

    rconn Administrator
    Staff Member

    May 14, 2008
    Likes Received:
    None of those are reproducible here, with either TCC or TCC/LE.
  5. fakoor

    Apr 11, 2011
    Likes Received:
    Mine is TCC/LE an gets stuck in the following loop [Disassembly of takecmd.dll by Visual Studio 2008]:
    100326DA  mov         edi,dword ptr ds:[100C6684h] 
    100326E0  cmp         word ptr [edi],0 
    100326E4  mov         esi,edi 
    100326E6  je          10032700 
    100326E8  push        esi  
    100326E9  call        ebx  
    100326EB  test        eax,eax 
    100326ED  jle         100326F0 
    100326EF  inc         eax  
    100326F0  cmp         word ptr [esi+eax*2],0 
    100326F5  lea         esi,[esi+eax*2] 
    100326F8  jne         100326E8 
    100326FA  mov         edi,dword ptr ds:[100C6684h] 
    10032700  mov         ebp,dword ptr [esp+1Ch] 
    10032704  mov         edx,esi 
    10032706  sub         edx,edi 
    10032708  sar         edx,1 
    1003270A  lea         eax,[edx+ebp+2] 
    1003270E  cmp         eax,dword ptr ds:[100CAB10h] 
    10032714  jb          1003273C 
    10032716  push        edi  
    10032717  call        ebx  
    10032719  test        eax,eax 
    1003271B  jle         1003271E 
    1003271D  inc         eax  
    1003271E  mov         edx,dword ptr ds:[100C6684h] 
    10032724  lea         eax,[edi+eax*2] 
    10032727  sub         esi,eax 
    10032729  sar         esi,1 
    1003272B  lea         ecx,[esi+esi+2] 
    1003272F  push        ecx  
    10032730  push        eax  
    10032731  push        edx  
    10032732  call        10075910 
    10032737  add         esp,0Ch 
    1003273A  jmp         100326DA 

Share This Page