Error in ZSERVER.LIB

There’s an error int he ZSERVER.LIB. This library takes care of generating and handling webforms. When using strings in the form, you need to supply a length for the string using, sspec_setfvlen. The help file states:

SYNTAX: int sspec_setfvlen(int form, int var, int len);

KEYWORDS:		tcpip, server

DESCRIPTION: 	Sets the length of a form variable (the maximum length of
					the string representation of the variable).  Note that for
					string variables, len should NOT include the NULL
					terminator.

So if you have a string of 9 length, with the NULL terminator at the 9th position, you should give length 8 for the string.

When the ZSERVER.LIB handles a string that is received from a webform, it sets a NULL on the position for the last position! That way the last character of the string is lost!

	case PTR16:
		strncpy((char *)vssp->addr, value, fv->varlen);
		// Ensure NULL-termination
		((char *)vssp->addr)[fv->varlen - 1] = '\0';
		break;

This should be:

	case PTR16:
		strncpy((char *)vssp->addr, value, fv->varlen);
		// Ensure NULL-termination
		((char *)vssp->addr)[fv->varlen] = '\0';
		break;

The checking of the length of the string in the webform, while posting, works okay… only when the input is handled, the problem occures!