diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-10-20 02:02:00 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:01:55 -0500 |
commit | 31e96d8def1dd2fea76d31a032d64e5917462dc8 (patch) | |
tree | 808f7c944e3aa873b4d6af6ddebfa8fa2e659986 /source4/lib | |
parent | 72093ce62f1e09db86452720fe8280ad66824cde (diff) | |
download | samba-31e96d8def1dd2fea76d31a032d64e5917462dc8.tar.gz samba-31e96d8def1dd2fea76d31a032d64e5917462dc8.tar.bz2 samba-31e96d8def1dd2fea76d31a032d64e5917462dc8.zip |
r3073: Fix bug in the handling of null-terminated ASCII strings in RPC.
Because we didn't count the null terminator, we would not move past it
in the packet.
Andrew Bartlett
(This used to be commit 8b38bffc7098610c469ab61b7e0e6884f046f286)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/util_str.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c index 03ba1399ef..07a2c1dbd1 100644 --- a/source4/lib/util_str.c +++ b/source4/lib/util_str.c @@ -1120,6 +1120,24 @@ int strcmp_safe(const char *s1, const char *s2) /******************************************************************* +return the number of bytes occupied by a buffer in ASCII format +the result includes the null termination +limited by 'n' bytes +********************************************************************/ +size_t ascii_len_n(const char *src, size_t n) +{ + size_t len; + + len = strnlen(src, n); + if (len+1 <= n) { + len += 1; + } + + return len; +} + + +/******************************************************************* Return a string representing a CIFS attribute for a file. ********************************************************************/ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib) |