Re: Problem with cookies
Status: Alpha
Brought to you by:
coroberti
|
From: web l. a. p. t. t. <cur...@li...> - 2007-07-25 04:44:14
|
Robert,
1) Well, basically the bug was in wrong assumption that
strtok_r() expects merely a pointer to a char as delimiter,
when it actually expects null-terminated string. There is
no way that code could work, unless, by some lucky
coincidence, the byte next to the delimeter char happened
to be null. See the patch below:
Index: parse_conf.c
===================================================================
--- parse_conf.c (revision 487)
+++ parse_conf.c (working copy)
@@ -419,6 +419,7 @@
if ((sp = strchr (input, separators_supported [i])))
{
*separator = *sp; /* Remember the separator */
+ separator[1] = '\0';
break;
}
}
@@ -441,8 +442,8 @@
size_t token_count = 0;
for (token = strtok_r (input, separator, &strtokp);
- token != 0;
- token = strtok_r (0, separator, &strtokp))
+ token != NULL;
+ token = strtok_r (NULL, separator, &strtokp))
{
size_t token_len = strlen (token);
@@ -2687,8 +2688,16 @@
{
char fgets_buff[512];
FILE* fp;
- char sep;
+ char *sep = malloc(sizeof(char) * 2);
+ if (NULL == sep)
+ {
+ fprintf (stderr,
+ "%s - failed to allocate memory for separator with errno
%d.\n",
+ __func__, errno);
+ return -1;
+ }
+
/*
Open the file with form records
*/
@@ -2751,7 +2760,7 @@
string_len,
&url->form_records_array[url->form_records_num],
url->form_records_num,
- &sep) == -1)
+ sep) == -1)
{
fprintf (stderr,
"%s - error: load_client_credentials_buffers ()
failed "
---------------------------------------------------------------------------
2) Yes, I did update the repo to version 487 today, and it still
fails unless I add -lidn to LIBS in Makefile.
Artur
----- Original Message -----
From: "Robert Iakobashvili" <cor...@gm...>
To: <cur...@li...>
Sent: Tuesday, July 24, 2007 8:52 PM
Subject: Re: Problem with cookies
> Artur,
>
> On 7/25/07, Artur B <ar...@gm...> wrote:
>>I've done some investigation today and found a bug in credentials file
>>parsing
>>code (load_form_records_file() and load_form_record_string() in
> parse_config.c).
>>Apparently nobody tested this feature before.
>
> We do tested, but "errare humanum est" ...
>
>>I've fixed it in my repo and now it works
>>just fine reading email:password pairs correctly from the credentials
> file. I need write
>>access to SVN to commit it.
>
> Great!
> Could you, please, either post the patch to the mailing list, or
> explain what to fix?
> Thanks.
>
>> Also, build fails for me unless I manually
>> add "-lidn" to LIBS variable in Makefile.
>> Shouldn't we fix it too?
>
> It was supposed to be fixed by a commit 2-3 days ago by
> adding an option --without-libidn to the Makefile. Could you, please,
> run
> $svn update
> with a further
> $make cleanall; make
> to see, if it works for you? Thanks.
>
>
> --
> Sincerely,
> Robert Iakobashvili,
> coroberti %x40 gmail %x2e com
> ...........................................................
> http://curl-loader.sourceforge.net
> A web testing and traffic generation tool.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> curl-loader-devel mailing list
> cur...@li...
> https://lists.sourceforge.net/lists/listinfo/curl-loader-devel
|