r13359: make sure we don't look at s[-1]
authorStefan Metzmacher <metze@samba.org>
Mon, 6 Feb 2006 00:27:02 +0000 (00:27 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:51:49 +0000 (13:51 -0500)
metze
(This used to be commit 24c6e2f73175befa33f9758634e3ee183916e387)

source4/lib/ldb/common/attrib_handlers.c

index 7d1eff6d9a14aece383e97b881ffb4ecdd2bcad5..ec89bdd1c4071498081c0885e9d30a9ead352969 100644 (file)
@@ -69,7 +69,7 @@ static int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
        
        /* remove trailing spaces if any */
        l = strlen(s);
-       while (s[l - 1] == ' ') l--;
+       while (l > 0 && s[l - 1] == ' ') l--;
        s[l] = '\0';
        
        /* remove leading spaces if any */