git.samba.org
/
amitay
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bf8f7a3
)
lib: debug: Avoid negative array access.
author
Jeremy Allison
<jra@samba.org>
Mon, 17 Apr 2017 21:09:24 +0000
(14:09 -0700)
committer
Andreas Schneider
<asn@cryptomilk.org>
Tue, 18 Apr 2017 09:47:17 +0000
(11:47 +0200)
Report and patch from Hanno Böck <hanno@hboeck.de>.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12746
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/util/debug.c
patch
|
blob
|
history
diff --git
a/lib/util/debug.c
b/lib/util/debug.c
index f48daf69553acc4a7266b8f698f618816eaf3e15..5abca41d534028ee01c7f255d6deecaf826f0bbc 100644
(file)
--- a/
lib/util/debug.c
+++ b/
lib/util/debug.c
@@
-488,7
+488,7
@@
static void debug_backends_log(const char *msg, int msg_level)
* a buffer without the newline character.
*/
len = MIN(strlen(msg), FORMAT_BUFR_SIZE - 1);
- if (
msg[len - 1] == '\n'
) {
+ if (
(len > 0) && (msg[len - 1] == '\n')
) {
len--;
}