fix off-by-one in the string validation check
[project/libubox.git] / blob.c
diff --git a/blob.c b/blob.c
index 26a23f3..003192e 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -147,7 +147,7 @@ blob_check_type(const void *ptr, int len, int type)
                        return false;
        }
 
-       if (type == BLOB_ATTR_STRING && data[len] != 0)
+       if (type == BLOB_ATTR_STRING && data[len - 1] != 0)
                return false;
 
        return true;