diff options
author | Frank Kühndel <frank.kuehndel@embedded-brains.de> | 2020-10-15 11:33:13 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-15 19:15:50 +0200 |
commit | 355bc37ad35a7d67a7209130171febe805c67f62 (patch) | |
tree | 547bd98e5ef899d62a932cb8be446e38ef71fb87 /cpukit/include | |
parent | 1dbd1079a5344c3c67d6bf75b04319725b02ce62 (diff) |
rtems-fdt / shell - Fix string truncation warning
The compiler warning was:
../../../cpukit/libmisc/rtems-fdt/rtems-fdt.c:267:5: warning:
'strncpy' specified bound depends on the length of the source argument
267 | strncpy(path, name, namelen);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
It turns out that the `strncpy()` nor the buffer `path` is needed when
one uses `strncmp()` instead of `strcmp()`. This needs some change to
the algorithm but has the advantage that `name` is never truncated
to the size of the buffer `path`.
Note:
rtems-fdt.c, rtems-fdt-shell.c and cpukit/include/rtems/rtems-fdt.h
seem to be dead code. They implement a shell command `fdt` but that
command is not part of the shell nor of any macro in
cpukit/include/rtems/shellconfig.h.
Diffstat (limited to 'cpukit/include')
0 files changed, 0 insertions, 0 deletions