Menu

#4 Patch for trailing null (DG814)

open
None
2
2007-12-29
2006-02-03
Mark Hale
No

Netgear DG814 router returns a trailing null after the
soap response. Patch for
org.cybergarage.soap.SOAPRequest to fix (only relevant
lines shown):

public SOAPResponse postMessage(String host, int port)
{
HTTPResponse httpRes = post(host, port);

SOAPResponse soapRes = new SOAPResponse(httpRes);

byte content[] = soapRes.getContent();
int len = content.length;
if (len <= 0)
return soapRes;

// trim trailing null (DG814)
if(content[len-1] == '\0')
len--;

try {
ByteArrayInputStream byteIn = new
ByteArrayInputStream(content, 0, len);

Discussion

  • Stefano Lenzi

    Stefano Lenzi - 2007-12-29
    • priority: 5 --> 2
    • assigned_to: nobody --> kismet-sl
     
  • Stefano Lenzi

    Stefano Lenzi - 2007-12-29

    Logged In: YES
    user_id=901512
    Originator: NO

    Is your patch general purpose? At first glace, it seems to me that will break the behavior with device non sending a extra 'null' character

     
  • Mark Hale

    Mark Hale - 2007-12-29

    Logged In: YES
    user_id=133877
    Originator: YES

    Yes, it is general purpose. It checks if the last character is null. If it is null (as in the case of DG814) then it removes the null. If the response doesnt send an extra null, then it's not removed.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.