Since strlcpy always null-terminates, and the buffer is zeroed before copy
anyway, there is no need to explicitly zero the end of the character
array, or to limit the bytes that strlcpy can write.

Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
---
 lib/librte_eal/common/eal_common_options.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index 0546beb3a..551507af1 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -326,8 +326,7 @@ eal_plugin_add(const char *path)
                return -1;
        }
        memset(solib, 0, sizeof(*solib));
-       strlcpy(solib->name, path, PATH_MAX-1);
-       solib->name[PATH_MAX-1] = 0;
+       strlcpy(solib->name, path, PATH_MAX);
        TAILQ_INSERT_TAIL(&solib_list, solib, next);
 
        return 0;
-- 
2.25.1

Reply via email to