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

XALLOC in program LIBHTTP/HTTPAPIR4



The header_parse routine in LIBHTTP/QRPGLESRC/HEADERR4 appears to have a
problem when a HTTP Header keyword is present but has no corresponding
value.

The following is a sample of a response I receive (I've substituted
<crlf> for x'0d25' for readability)


HTTP/1.1 200 OK<crlf>Date: Thu, 09 Sep 2010 15:38:53 GMT<crlf>Server:
Microsoft-IIS/6.0<crlf>SN: 29<crlf>ETag:<crlf>X-Powered-By:
ASP.NET<crlf>X-AspNet-Version: 4.0.30319<crlf>Transfer-Encoding:
chunked<crlf>Cache-Control: private<crlf>Content-Type:
application/pdf<crlf><crlf>


Note that the Etag: has no corresponding value and is followed by
<crlf>. The result is that the parsing routine asks for 0 bytes to be
allocated by XALLOC at 

	eval      p_Header = xalloc(len)

This results in 

	Message . . . . :   The length requested for storage allocation
is out of range.

 

	Cause . . . . . :   RPG procedure XALLOC in program
LIBHTTP/HTTPAPIR4 tried to allocate storage with a length that was not a
value between 1 and 				16776704.

Is the HTTP response always supposed to supply a value when a keyword is
present? 

As a safeguard would it make sense if the parsing routine handled the
case where no values is provided?

Thanks,
Rick Connor

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------