[rtems-libbsd commit] freebsd/libc/rpc: Fix the fgets emulation for the internal netconfig support
Chris Johns
chrisj at rtems.org
Tue Sep 7 23:32:46 UTC 2021
Module: rtems-libbsd
Branch: 6-freebsd-12
Commit: 715e29f2a0d2b3d3fe469a4daf4af400a62f873b
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=715e29f2a0d2b3d3fe469a4daf4af400a62f873b
Author: Chris Johns <chrisj at rtems.org>
Date: Wed Sep 8 09:19:28 2021 +1000
freebsd/libc/rpc: Fix the fgets emulation for the internal netconfig support
---
freebsd/lib/libc/rpc/getnetconfig.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/freebsd/lib/libc/rpc/getnetconfig.c b/freebsd/lib/libc/rpc/getnetconfig.c
index 4c66122..69f69bd 100644
--- a/freebsd/lib/libc/rpc/getnetconfig.c
+++ b/freebsd/lib/libc/rpc/getnetconfig.c
@@ -93,8 +93,9 @@ nc_fgets(char * str, int size, FILE *stream) {
if (p == NULL)
return NULL;
l = strlen(p);
- size = l < size ? l : size;
+ size = l < size ? l : size - 1;
memcpy(str, p, size);
+ str[size] = '\0';
++netconfig_next;
return str;
}
More information about the vc
mailing list