Ignore:
Timestamp:
Apr 10, 2007, 5:27:38 AM (14 years ago)
Author:
Paul Smedley
Message:

Updated source to 3.0.25rc1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/lib/util_str.c

    r1 r26  
    425425
    426426/**
    427  Skip past some strings in a buffer.
    428 **/
    429 
    430 char *skip_string(char *buf,size_t n)
    431 {
    432         while (n--)
    433                 buf += strlen(buf) + 1;
     427 *  Skip past some strings in a buffer - old version - no checks.
     428 *  **/
     429
     430char *push_skip_string(char *buf)
     431{
     432        buf += strlen(buf) + 1;
    434433        return(buf);
     434}
     435
     436/**
     437 Skip past a string in a buffer. Buffer may not be
     438 null terminated. end_ptr points to the first byte after
     439 then end of the buffer.
     440**/
     441
     442char *skip_string(const char *base, size_t len, char *buf)
     443{
     444        const char *end_ptr = base + len;
     445
     446        if (end_ptr < base || !base || !buf || buf >= end_ptr) {
     447                return NULL;
     448        }
     449
     450        /* Skip the string */
     451        while (*buf) {
     452                buf++;
     453                if (buf >= end_ptr) {
     454                        return NULL;
     455                }
     456        }
     457        /* Skip the '\0' */
     458        buf++;
     459        return buf;
    435460}
    436461
     
    25922617        return len;
    25932618}
    2594 
Note: See TracChangeset for help on using the changeset viewer.