mirror of
https://github.com/armink/FlashDB.git
synced 2026-08-17 17:11:50 +08:00
[kvdb] fix null-pointer dereference (#314)
The C library function - strlen() does not accept a null-pointer. Signed-off-by: FragrantRye <903465575@qq.com>
This commit is contained in:
+5
-1
@@ -1380,7 +1380,11 @@ fdb_err_t fdb_kv_set(fdb_kvdb_t db, const char *key, const char *value)
|
||||
{
|
||||
struct fdb_blob blob;
|
||||
|
||||
return fdb_kv_set_blob(db, key, fdb_blob_make(&blob, value, strlen(value)));
|
||||
if (value) {
|
||||
return fdb_kv_set_blob(db, key, fdb_blob_make(&blob, value, strlen(value)));
|
||||
} else {
|
||||
return fdb_kv_del(db, key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user