Use strcmp() insead of memcmp() when searching for keys as otherwise the comparison will run off the end of the NULL-terminated string.
Signed-off-by: Ross Burton <[email protected]> --- pseudo_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pseudo_util.c b/pseudo_util.c index 1d06009..51c07c2 100644 --- a/pseudo_util.c +++ b/pseudo_util.c @@ -159,7 +159,7 @@ pseudo_get_value(const char *key) { if (pseudo_util_initted == -1) pseudo_init_util(); - for (i = 0; pseudo_env[i].key && memcmp(pseudo_env[i].key, key, pseudo_env[i].key_len + 1); i++) + for (i = 0; pseudo_env[i].key && strcmp(pseudo_env[i].key, key); i++) ; /* Check if the environment has it and we don't ... @@ -188,7 +188,7 @@ pseudo_set_value(const char *key, const char *value) { if (pseudo_util_initted == -1) pseudo_init_util(); - for (i = 0; pseudo_env[i].key && memcmp(pseudo_env[i].key, key, pseudo_env[i].key_len + 1); i++) + for (i = 0; pseudo_env[i].key && strcmp(pseudo_env[i].key, key); i++) ; if (pseudo_env[i].key) { -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#146542): https://lists.openembedded.org/g/openembedded-core/message/146542 Mute This Topic: https://lists.openembedded.org/mt/79523825/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
