diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-12-10 00:07:51 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-12-10 00:07:51 +0000 |
commit | 4ad81e7714bac620ae8c5a3a341548523c7ceada (patch) | |
tree | fc425785a92483c564037c3d88663358acdc0f02 /source3 | |
parent | cb1195fdef5466b3ee565b03c2fe990a86916c70 (diff) | |
download | samba-4ad81e7714bac620ae8c5a3a341548523c7ceada.tar.gz samba-4ad81e7714bac620ae8c5a3a341548523c7ceada.tar.bz2 samba-4ad81e7714bac620ae8c5a3a341548523c7ceada.zip |
explicitly encode NULL strings in the cache
(This used to be commit 77c1376456765a7afe90afad96fab819fdcf8af3)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nsswitch/winbindd_cache.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c index 4221e26ee1..e78410e3a5 100644 --- a/source3/nsswitch/winbindd_cache.c +++ b/source3/nsswitch/winbindd_cache.c @@ -119,6 +119,12 @@ static char *centry_string(struct cache_entry *centry, TALLOC_CTX *mem_ctx) char *ret; len = centry_uint32(centry); + + if (len == 0xFFFF) { + /* a deliberate NULL string */ + return NULL; + } + if (centry->len - centry->ofs < len) { DEBUG(0,("centry corruption? needed %d bytes, have %d\n", len, centry->len - centry->ofs)); @@ -267,7 +273,15 @@ static void centry_put_uint32(struct cache_entry *centry, uint32 v) */ static void centry_put_string(struct cache_entry *centry, const char *s) { - int len = strlen(s); + int len; + + if (!s) { + /* null strings are marked as len 0xFFFF */ + centry_put_uint32(centry, 0xFFFF); + return; + } + + len = strlen(s); centry_put_uint32(centry, len); centry_expand(centry, len); memcpy(centry->data + centry->ofs, s, len); |