Changeset effbb7 in libssh2


Ignore:
Timestamp:
02/01/12 10:56:42 (4 months ago)
Author:
peter.stuge.se
Branches:
master
Children:
e95c7d
Parents:
0ebe6f
git-author:
Peter Stuge <peter@…> (02/01/12 10:56:42)
git-committer:
Peter Stuge <peter@…> (02/01/12 11:35:05)
Message:

example/subsystem_netconf.c: Return error when read buffer is too small

Also remove a little redundancy in the read loop condition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • example/subsystem_netconf.c

    r0ebe6f reffbb7  
    6262                              char *buf, size_t buflen) 
    6363{ 
    64     ssize_t len, rd = 0; 
     64    ssize_t len; 
     65    size_t rd = 0; 
    6566    char *endreply = NULL, *specialsequence = NULL; 
    6667 
     
    8687            specialsequence = strstr(endreply, "]]>]]>"); 
    8788 
    88     } while (!endreply || !specialsequence); 
     89    } while (!specialsequence && rd < buflen); 
     90 
     91    if (!specialsequence) { 
     92        fprintf(stderr, "%s: ]]>]]> not found! read buffer too small?\n", __func__); 
     93        return -1; 
     94    } 
    8995 
    9096    /* discard the special sequence so that only XML is returned */ 
Note: See TracChangeset for help on using the changeset viewer.