Ensure that sethostname null terminates the hostname correctly

commit e1c306f2dd added sethostname using
strncpy. This replaces it with strlcpy and uses sizeof() instead of
re-calculating the buffer size.

Rename size argument for get/sethostname to match the implementation
This commit is contained in:
Norman Rasmussen
2021-12-29 03:22:42 -08:00
committed by Xiang Xiao
parent fc41bb7f8a
commit df956b08f2
2 changed files with 4 additions and 5 deletions

View File

@@ -386,8 +386,8 @@ FAR int *getopterrp(void); /* Print error message */
FAR int *getoptindp(void); /* Index into argv */
FAR int *getoptoptp(void); /* Unrecognized option character */
int gethostname(FAR char *name, size_t size);
int sethostname(FAR const char *name, size_t size);
int gethostname(FAR char *name, size_t namelen);
int sethostname(FAR const char *name, size_t namelen);
/* Get configurable system variables */