Ethereal-dev: [Ethereal-dev] Re: packet-pgsql.c changes in 0.10.9

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 08 Mar 2005 00:16:38 -0800
Abhijit Menon-Sen wrote:

The protocol message that code is decoding contains a four byte signed
integer field. A positive value indicates a number of bytes to follow,
and the special value -1 is used to indicate an SQL NULL value (and no
bytes follow in that case).

What are all the places where a special value of -1 means "null value"? Is that the case both for "Bind" and "Function call" operations?

Thus, the problem with the "n += l" is if l < 0 (which, in my original
code that declared it a gint, it could be).

The original code was apparently not sent in

	http://www.ethereal.com/lists/ethereal-dev/200412/msg00262.html

as the version in that code declares "l" to be a guint32.

So is the correct fix, then, to change "l" to be a gint and:

	for a value of -1, treat it as a null value;

	for any other negative value, treat it as an error?