summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/winbindd/idmap_hash/mapfile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/winbindd/idmap_hash/mapfile.c b/source3/winbindd/idmap_hash/mapfile.c
index ec846f37eb..a0e2b489cb 100644
--- a/source3/winbindd/idmap_hash/mapfile.c
+++ b/source3/winbindd/idmap_hash/mapfile.c
@@ -74,7 +74,12 @@ static bool mapfile_read_line(fstring key, fstring value)
/* Strip newlines and carriage returns */
- len = strlen_m(buffer) - 1;
+ len = strlen_m(buffer);
+ if (len == 0) {
+ return false;
+ }
+ len -= 1;
+
while ((buffer[len] == '\n') || (buffer[len] == '\r')) {
buffer[len--] = '\0';
}