lwIP | rtemslwip/network_compat: Add gethostname/gethostid (!28)
Gedare Bloom (@gedare)
gitlab at rtems.org
Fri Sep 5 20:52:02 UTC 2025
Gedare Bloom commented on a discussion on rtemslwip/common/network_compat.c: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/28#note_130503
> +static char hostname[_POSIX_HOST_NAME_MAX] = {0};
> +static int hostname_len = 1;
> +
> +int gethostname(char *name, size_t size)
> +{
> + int copy_size = hostname_len;
> +
> + if (name == NULL) {
> + errno = EFAULT;
> + return -1;
> + }
> + if (copy_size > size) {
> + copy_size = size;
> + }
> +
> + memcpy(name, hostname, copy_size);
If the `hostname` is stored without `\0`, this will truncate the written hostname by 1 character?
--
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/28#note_130503
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250905/8e2cb553/attachment-0001.htm>
More information about the bugs
mailing list