diff options
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r-- | source3/lib/util_str.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 032627db94..457232c2b2 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -427,20 +427,19 @@ void string_replace( pstring s, char oldc, char newc ) * Skip past some strings in a buffer - old version - no checks. * **/ -char *push_skip_string(char *buf,size_t n) +char *push_skip_string(char *buf) { - while (n--) - buf += strlen(buf) + 1; + buf += strlen(buf) + 1; return(buf); } /** - Skip past some strings in a buffer. Buffer may not be + Skip past a string in a buffer. Buffer may not be null terminated. end_ptr points to the first byte after then end of the buffer. **/ -char *skip_string(const char *base, size_t len, char *buf, size_t n) +char *skip_string(const char *base, size_t len, char *buf) { const char *end_ptr = base + len; @@ -448,18 +447,15 @@ char *skip_string(const char *base, size_t len, char *buf, size_t n) return NULL; } - while (n--) { - /* Skip the string */ - while (*buf) { - buf++; - if (buf >= end_ptr) { - return NULL; - } - } - /* Skip the '\0' */ + /* Skip the string */ + while (*buf) { buf++; + if (buf >= end_ptr) { + return NULL; + } } - + /* Skip the '\0' */ + buf++; return buf; } |