mirror of
https://github.com/armink/FlashDB.git
synced 2025-01-29 04:32:53 +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:
parent
523fd2052d
commit
fd08d7f323
@ -1380,7 +1380,11 @@ fdb_err_t fdb_kv_set(fdb_kvdb_t db, const char *key, const char *value)
|
|||||||
{
|
{
|
||||||
struct fdb_blob blob;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user