httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vitaliy Kaplenko <eps_...@yahoo.com.INVALID>
Subject Re: The Apache docs readPost causing SIGSEGV
Date Tue, 19 May 2015 12:59:49 GMT
Thank you very much, Joe !!! 
Thanks to your advice, I decided the issue.
Thank you!

Sincerely,
Vitaliy 



     On Tuesday, May 19, 2015 6:27 AM, Joe Lewis <jlewis@silverhawk.net> wrote:
   

 Please check how you are creating the formData[i].key and format[i].value
fields.  If you are using the POST data in the structure, it is not NULL
terminated.  You have to do your own NULL termination, or (when it reads
out of bounds) you get a SIGSEGV.  Unless you are lucky and have NULL
characters in your own module.

I don't like using the apr_pstrdup, I use the apr_pstrndup form because I
have complete control of size, and I make it one character bigger, and add
a NULL termination to the string JUST to make sure.  I had enough SIGSEGV's
in my life to call it a best practice to make sure the character is there.

Joe

On Mon, May 18, 2015 at 1:45 PM, Vitaliy Kaplenko <eps_kvv@yahoo.com.invalid
> wrote:

> Hi,
> I am developing a module for Apache that requires parsing form data. As
> example I have used "Retrieve variables from POST form data" from
> http://httpd.apache.org/docs/2.4/developer/modguide.html#snippets.
>
> When I try to retrieve variables from Post data, in the example
> row: ap_rprintf(r, "%s = %s\n", formData[i].key, formData[i].value);
>
> I got:Program received signal SIGSEGV, Segmentation fault.strlen () at
> ../sysdeps/x86_64/strlen.S:106106 movdqu (%rax), %xmm12
>
> Is there any way to pass it?Thanks!


  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message