diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-11-01 03:17:23 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2006-11-01 03:17:23 +0000 |
commit | 77dc6244856fcbfc2896b997dd6520a721953ddb (patch) | |
tree | 033b944da744b8c08549cf89142f319c91bd8873 /source/lib/ldb | |
parent | b06ae920ad1bb5bafc33c6b3e321dd3e0b41ad0f (diff) | |
download | samba-77dc6244856fcbfc2896b997dd6520a721953ddb.tar.gz samba-77dc6244856fcbfc2896b997dd6520a721953ddb.tar.xz samba-77dc6244856fcbfc2896b997dd6520a721953ddb.zip |
r19520: Try not to read past the end of the ldb buffer.
Andrew Bartlett
Diffstat (limited to 'source/lib/ldb')
-rw-r--r-- | source/lib/ldb/samba/ldif_handlers.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/lib/ldb/samba/ldif_handlers.c b/source/lib/ldb/samba/ldif_handlers.c index 46eac2295d6..42f7605385c 100644 --- a/source/lib/ldb/samba/ldif_handlers.c +++ b/source/lib/ldb/samba/ldif_handlers.c @@ -80,10 +80,12 @@ static int ldif_write_objectSid(struct ldb_context *ldb, void *mem_ctx, static BOOL ldb_comparision_objectSid_isString(const struct ldb_val *v) { - /* see if the input if null-terninated */ - if (v->data[v->length] != '\0') return False; - + if (v->length < 3) { + return False; + } + if (strncmp("S-", (const char *)v->data, 2) != 0) return False; + return True; } @@ -179,9 +181,6 @@ static BOOL ldb_comparision_objectGUID_isString(const struct ldb_val *v) struct GUID guid; NTSTATUS status; - /* see if the input if null-terninated */ - if (v->data[v->length] != '\0') return False; - if (v->length < 33) return False; status = GUID_from_string((const char *)v->data, &guid); |