Re: Munge /r and /n in HTTP_HttpSendRequestA
Uwe Bonnes wrote:
The test for nLen is a good idea. But with nLen = strlen(lpwhr->lpszPath); lpwhr->lpszPath[nLen] should give the terminating NULL to my understanding...
Or am I off by one?
According to my ANSI C book strlen() returns the number of characters in a string NOT including the zero termination character. So I think in that case you would be indeed off by one. Rolf Kalbermatter
"Rolf" == Rolf Kalbermatter <rolf.kalbermatter(a)citeng.com> writes:
Rolf> Uwe Bonnes wrote: >> The test for nLen is a good idea. But with nLen = >> strlen(lpwhr->lpszPath); lpwhr->lpszPath[nLen] should give the >> terminating NULL to my understanding... >> >> Or am I off by one? Rolf> According to my ANSI C book strlen() returns the number of Rolf> characters in a string NOT including the zero termination Rolf> character. So I think in that case you would be indeed off by one. Huch: STRLEN(3) Linux Programmer's Manual STRLEN(3) NAME strlen - calculate the length of a string SYNOPSIS #include <string.h> size_t strlen(const char *s); DESCRIPTION The strlen() function calculates the length of the string s, not including the terminating `\0' character. What counts? -- Uwe Bonnes bon(a)elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
"Rolf" == Rolf Kalbermatter <rolf.kalbermatter(a)citeng.com> writes:
Rolf> Uwe Bonnes wrote: >> The test for nLen is a good idea. But with nLen = >> strlen(lpwhr->lpszPath); lpwhr->lpszPath[nLen] should give the >> terminating NULL to my understanding... >> >> Or am I off by one? char test[]="a" strlen(test) = 1; test[strlen(test)-1] = 'a' test[0] = 'a' test[strlen(test)] = '\0' char test1[]="a\n" strlen(test1) = 2; test1[strlen(test)-1] = '\n' In this case, my patch overwrites test1[strlen(test)-1] with '\0' This is what I intend. -- Uwe Bonnes bon(a)elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
participants (2)
-
Rolf Kalbermatter -
Uwe Bonnes