Menu

#1308 Access violation in soap_putcookies for domain level cookies

v1.0 (example)
closed-fixed
None
5
2022-12-04
2022-10-11
dsww
No

Since 2.8.81 in soap_putcookies the hostname is resolved with the wrapper function tcp_gethostbyname. This is the only location where the parameter hostent is used. Unfortunately the parameter hostent will not be returned because it is defined as a pointer to hostent. Within the function not the content is written but the pointer itself, which will be ignored when you return from the function.

so the function is defined like this:
static int tcp_gethostbyname(struct soap *soap, const char *addr, struct hostent *hostent, struct in_addr *inaddr);

and within the function the parameter is set like this:
hostent = gethostbyname((char*)addr);

We updated from 2.8.68 to 2.8.123 and run into this problem when domain level cookies are used.
Please consider changing the tcp_gethostbyname function.

Discussion

  • Robert van Engelen

    A method like this should fix it:

    {
        struct hostent *temp;
    #ifdef AS400
        temp = gethostbyname((void*)addr);
    #else
        temp = gethostbyname((char*)addr);
    #endif
        if (!temp)
        {
          soap->errnum = h_errno;
          hostent = NULL;
        }
        else
        {
          *hostent = *temp;
        }
      }
    
     
  • Robert van Engelen

    • status: open --> closed-fixed
    • assigned_to: Robert van Engelen
     

Log in to post a comment.