summaryrefslogtreecommitdiffstats
path: root/bsps/shared
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/shared')
-rw-r--r--bsps/shared/ofw/ofw.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c
index fa94bfbf05..886ad0252b 100644
--- a/bsps/shared/ofw/ofw.c
+++ b/bsps/shared/ofw/ofw.c
@@ -198,7 +198,15 @@ ssize_t rtems_ofw_get_prop(
if (prop == NULL && strcmp(propname, "name") == 0) {
prop = fdt_get_name(fdtp, offset, &len);
- strncpy(buf, prop, bufsize);
+
+ /* Node name's are 1-31 chars in length consisting of only
+ * ascii chars and are null terminated */
+ strlcpy(buf, prop, bufsize);
+
+ /* Return the length of the name including the null byte
+ * rather than the amount copied.
+ * This is the behaviour in libBSD ofw_fdt_getprop
+ */
return len + 1;
}