summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2021-09-08 09:19:28 +1000
committerChris Johns <chrisj@rtems.org>2021-09-08 09:23:09 +1000
commit715e29f2a0d2b3d3fe469a4daf4af400a62f873b (patch)
treef2eb144b4a249d3cf6633a3a349606bb43e3a118
parentimx: Remove ccm functions alredy defined in RTEMS (diff)
downloadrtems-libbsd-715e29f2a0d2b3d3fe469a4daf4af400a62f873b.tar.bz2
freebsd/libc/rpc: Fix the fgets emulation for the internal netconfig support
-rw-r--r--freebsd/lib/libc/rpc/getnetconfig.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/freebsd/lib/libc/rpc/getnetconfig.c b/freebsd/lib/libc/rpc/getnetconfig.c
index 4c66122d..69f69bd2 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;
}