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

RE: HTTPAPI



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


Hi Rick,

> I have attached a copy of the RPGLE program.  You won't be able to run
> program but maybe can point me to the problem.  This is basically the
> code that you send me a few weeks ago.  You helped me with a problem and
> made changes to show me how to use persistant connections to eliminate
> the eating up of ports in netstat.  Each time I end this program I
> receive the error.

I do see one bug in the Incoming() procedure (the same bug exists in
EXAMPLE5 that comes with HTTPAPI)

The problem is in the following code:

  C* Make sure we don't overflow the string:
  c                   eval      retlen = (nextpos + datalen) - 1
  c                   if        retlen > %size(retdata)
  c                   eval      datalen=datalen-(%size(retdata)-retlen)
  c                   endif

...  if retlen is greater than the size of retdata, then, on the next
line, (%size(retdata)-retlen) will always be a negative number, which is a
problem because a negative number would increase the value of "datalen."

I think the following code is correct:

  c                   eval      retlen = (nextpos + datalen) - 1
  c                   if        retlen > %size(retdata)
  c                   eval      datalen=datalen-(retlen-%size(retdata))
  c                   endif

However, I can't see why this would cause the error that you describe.
Might be worth a try, though.

Otherwise, I don't see anything wrong in the program you sent -- but then,
can YOU find all your programs bugs just by reading the code?  Or do you
need to be able to actually run it to find them?  Personally, I don't
usually find everything just by glancing at it.

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------