diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-11-01 03:17:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:24:43 -0500 |
commit | abe0c30abafbc982d4031ad3585e262bd192e452 (patch) | |
tree | b6a4b259fbc133380a7c620de70f6264d314abd1 /source4/lib/ldb | |
parent | 56c9e61d10976b7eae34bf7f064d45c0c4dbe8b8 (diff) | |
download | samba-abe0c30abafbc982d4031ad3585e262bd192e452.tar.gz samba-abe0c30abafbc982d4031ad3585e262bd192e452.tar.bz2 samba-abe0c30abafbc982d4031ad3585e262bd192e452.zip |
r19520: Try not to read past the end of the ldb buffer.
Andrew Bartlett
(This used to be commit 3a103149a6c083b80f25163c0f3762f86bb496c1)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/samba/ldif_handlers.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source4/lib/ldb/samba/ldif_handlers.c b/source4/lib/ldb/samba/ldif_handlers.c index 46eac2295d..42f7605385 100644 --- a/source4/lib/ldb/samba/ldif_handlers.c +++ b/source4/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); |