dict BUGFIX check whole compared string

Fixes #2108
diff --git a/src/dict.c b/src/dict.c
index 07631f6..24c7ac6 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -36,15 +36,19 @@
 static ly_bool
 lydict_val_eq(void *val1_p, void *val2_p, ly_bool UNUSED(mod), void *cb_data)
 {
+    const char *str1, *str2;
+    size_t *len1;
+
     LY_CHECK_ARG_RET(NULL, val1_p, val2_p, cb_data, 0);
 
-    const char *str1 = ((struct ly_dict_rec *)val1_p)->value;
-    const char *str2 = ((struct ly_dict_rec *)val2_p)->value;
+    str1 = ((struct ly_dict_rec *)val1_p)->value;
+    str2 = ((struct ly_dict_rec *)val2_p)->value;
+    len1 = cb_data;
 
     LY_CHECK_ERR_RET(!str1, LOGARG(NULL, val1_p), 0);
     LY_CHECK_ERR_RET(!str2, LOGARG(NULL, val2_p), 0);
 
-    if (strncmp(str1, str2, *(size_t *)cb_data) == 0) {
+    if (!strncmp(str1, str2, *len1) && !str2[*len1]) {
         return 1;
     }