projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0b80a7b
)
fix out of bounds write for zero length buffer in gethostname
author
Marc André Tanner
<mat@brain-dump.org>
Sun, 11 Mar 2018 08:55:06 +0000
(09:55 +0100)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 19 Apr 2018 15:45:22 +0000
(11:45 -0400)
src/unistd/gethostname.c
patch
|
blob
|
history
diff --git
a/src/unistd/gethostname.c
b/src/unistd/gethostname.c
index f984b7dd2f9a88dde7fb23132424f912c17bcdc0..633ef571a4011332e2b47fc14a1841e398cc792a 100644
(file)
--- a/
src/unistd/gethostname.c
+++ b/
src/unistd/gethostname.c
@@
-8,6
+8,6
@@
int gethostname(char *name, size_t len)
if (uname(&uts)) return -1;
if (len > sizeof uts.nodename) len = sizeof uts.nodename;
for (i=0; i<len && (name[i] = uts.nodename[i]); i++);
- if (i==len) name[i-1] = 0;
+ if (i
&& i
==len) name[i-1] = 0;
return 0;
}