summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-02 20:10:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:05 -0500
commit0a2cc569a1803f459f7db77d03e6e90ae30aa35d (patch)
tree3c7a1ad14eaaa502642ee1704ec1712d9fddee35 /source3/lib
parent8990b13d2f576aac2e32cec91c0a70adf8b58539 (diff)
downloadsamba-0a2cc569a1803f459f7db77d03e6e90ae30aa35d.tar.gz
samba-0a2cc569a1803f459f7db77d03e6e90ae30aa35d.tar.bz2
samba-0a2cc569a1803f459f7db77d03e6e90ae30aa35d.zip
r22045: As Volker noticed, skip_string's last argument is
redundent. Remove it. Jeremy. (This used to be commit 140881cfbb59ce4a699b5900efe02bf315be7bd5)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c2
-rw-r--r--source3/lib/util_str.c26
2 files changed, 12 insertions, 16 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index b558571a77..64afa1cc53 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -3168,7 +3168,7 @@ char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t o
return NULL;
}
/* Check if a valid string exists at this offset. */
- if (skip_string(buf_base,buf_len, ptr + off, 1) == NULL) {
+ if (skip_string(buf_base,buf_len, ptr + off) == NULL) {
return NULL;
}
return ptr + off;
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;
}