projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
48ddca5
)
basic/strbuf: do not call bsearch with a null argument
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 18 Feb 2016 22:33:10 +0000
(17:33 -0500)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Fri, 19 Feb 2016 00:39:09 +0000
(19:39 -0500)
Das ist verboten!
src/basic/strbuf.c:162:23: runtime error: null pointer passed as argument 2,
which is declared to never be null
src/basic/strbuf.c
patch
|
blob
|
history
diff --git
a/src/basic/strbuf.c
b/src/basic/strbuf.c
index 77220c025147337e126fbe12d3a1197fb79785ac..dac288160392adf755f765cddb81251c427fe792 100644
(file)
--- a/
src/basic/strbuf.c
+++ b/
src/basic/strbuf.c
@@
-156,6
+156,10
@@
ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len) {
return off;
}
+ /* bsearch is not allowed on a NULL sequence */
+ if (node->children_count == 0)
+ break;
+
/* lookup child node */
c = s[len - 1 - depth];
search.c = c;