Index: fe-exec.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/fe-exec.c,v
retrieving revision 1.152
diff -r1.152 fe-exec.c
2352,2354d2351
< 	int			i,
< 				j,
< 				byte;
2366c2363
< 	for (i = j = buflen = 0; i < (int)strtextlen;)
---
> 	for(tmpbuf=buffer,buflen=0;*strtext;) /*go through the sting untill we hit the terminating 0*/
2368c2365
< 		switch (strtext[i])
---
> 		switch (*strtext)
2371,2373c2368,2370
< 				i++;
< 				if (strtext[i] == '\\')
< 					buffer[j++] = strtext[i++];
---
> 				strtext++;
> 				if (*strtext == '\\')
> 					*(buffer++) = *(strtext++);
2376,2378c2373,2375
< 					if ((isdigit(strtext[i])) &&
< 						(isdigit(strtext[i + 1])) &&
< 						(isdigit(strtext[i + 2])))
---
> 					if ((isdigit(*strtext)) &&
> 						(isdigit(*(strtext + 1))) &&
> 						(isdigit(*(strtext + 2))))
2380,2382c2377,2379
< 						byte = VAL(strtext[i++]);
< 						byte = (byte << 3) + VAL(strtext[i++]);
< 						buffer[j++] = (byte << 3) + VAL(strtext[i++]);
---
> 						*(buffer++) = (VAL(*(strtext)) << 6) + (VAL(*(strtext+1)) << 3)
> 							+ VAL(*(strtext+2));
> 						strtext+=3;
2388c2385
< 				buffer[j++] = strtext[i++];
---
> 				*(buffer++) = *(strtext++);
2389a2387,2388
> 		buflen++;			/* buflen is the length of the unquoted
> 						   		 * data */
2391,2392d2389
< 	buflen = j;					/* buflen is the length of the unquoted
< 								 * data */
2395c2392
< 	tmpbuf = realloc(buffer, buflen);
---
> 	buffer = realloc(tmpbuf, buflen);
2398c2395
< 	if (!tmpbuf)
---
> 	if (!buffer)
2400c2397
< 		free(buffer);
---
> 		free(tmpbuf);
2405c2402
< 	return tmpbuf;
---
> 	return buffer;
