[Zope] pcgi-wrapper.exe

Larry Luther l.luther@acm.org
Mon, 24 Jan 2000 20:31:53 -0800


pcgi-wrapper.c bugs & programming oddities

    * The first error stems from using strlen and atol
      on a buffer which has not been null terminated.
      The program works because the programmer got lucky
      because the buffer is followed by a pointer which
      is initialized to zero and is never used.

      In "main":

        char t[10]={0};  should be  char t[HDRLEN+1] = {0};


    *  Remove estatus & emsg, they are not used.


    * sizeof(char) is used liberally, but according to
      "The C Programming language" 2nd edition ANSI version.
      "sizeof(char) == 1", see Pg 204 under A7.4.8.
      When "sizeof(char)" is replaced by "1", the code
      simplifies nicely.


    * After "Receive stdout and stderr" buffers are allocated
      one byte larger than necessary and the whole buffer
      is cleared before the read.  Both operations can be
      removed and the code cleaned up.

    Larry