Menu

#1317 base64 decode is not proper for some of the input values

v1.0 (example)
closed-invalid
None
1
2023-11-30
2023-11-27
No

struct _ne3scommon__startRegistration {

    struct ne3scommon__identity *managerIdentity;
    char *agentUniqueId;
     char *notificationConsumerURL;
     char *reRegisterInterval;
***      struct xsdbase64Binary managerNonce;***
       int __sizeextensions;
    struct ne3scommon__extension *extensions;
    /** Required element 'ne3scommon:soc' of XML schema type 'ns1:swaRef' */
    char *soc;

};

XML Request :-

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:body>
<startregistration xmlns="http://www.nokiasiemens.com/ne3s/1.0">
<manageridentity>
<uniqueid>58095598</uniqueid>
<type>VS</type>
<vendor>NSN</vendor>
<release>1.0</release>
</manageridentity>
<agentuniqueid>Esymac</agentuniqueid>
<notificationconsumerurl>http://localhost:8081/axis2/services</notificationconsumerurl>
<reregisterinterval>10</reregisterinterval>
*** <managernonce>MTgwNzIxMDM3MQ==</managernonce>***
<soc>cid:startRegistrationContent1701064035586@nokiasiemens.com</soc>
</startregistration>
</soapenv:body>
</soapenv:envelope>

For encoded base64 MTgwNzIxMDM3MQ== decoded base64 should be 1807210371

But gsoap is throwing invalid valuse :- 1719984855

Discussion

  • Robert van Engelen

    • status: open --> closed-invalid
     
  • Robert van Engelen

    This works perfectly fine, see below. Perhaps the problem is located elsewhere in the XML or in the application itself?

    Examples to test the two base64 decoders. This one converts base64 strings to data:

    #include "stdsoap2.h"
    
    int main()
    {
      char buf[256];
      int num;
      struct soap *ctx = soap_new();
      if (soap_base642s(ctx, "MTgwNzIxMDM3MQ==", buf, sizeof(buf), &num) != NULL)
        printf("%s (%d)\n", buf, num);
      else
        soap_print_fault(ctx, stderr);
    }
    

    and this one parses base64 from standard input:

    int main()
    {
      char buf[256];
      int num;
      struct soap *ctx = soap_new();
      ctx->recvfd = 0;
      const char *result = soap_getbase64(ctx, &num, 0);
      if (result)
        printf("%s (%d)\n", result, num);
      else
        soap_print_fault(ctx, stderr);
    }
    

    which works like this:

    echo 'MTgwNzIxMDM3MQ==' | ./a.out
    1807210371 (10)
    
     

Log in to post a comment.