|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH] lib/sysinfo: Avoid stringop-overflow warning
Avoids the GCC warning: stringop-overflow. The length argument to
`strncpy()` in `gethostname()` depend on a computed value done by
`strlen()`. We fix this by taking the given `len` argument to the
`strncpy()` operation instead.
Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
lib/posix-sysinfo/sysinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/posix-sysinfo/sysinfo.c b/lib/posix-sysinfo/sysinfo.c
index 2bf2c12a..7bcfc8b3 100644
--- a/lib/posix-sysinfo/sysinfo.c
+++ b/lib/posix-sysinfo/sysinfo.c
@@ -141,7 +141,7 @@ int gethostname(char *name, size_t len)
return -1;
}
- strncpy(name, buf.nodename, node_len);
+ strncpy(name, buf.nodename, len);
return 0;
}
--
2.20.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |