clang/'Logic error': fix loop cond to avoid nullptr deref

nvim_set_decoration_provider() has insufficient null checks.
This commit is contained in:
Jan Edmund Lazo
2021-04-02 08:38:37 -04:00
parent 4d396271e1
commit 49706a1842

View File

@@ -2960,7 +2960,7 @@ void nvim_set_decoration_provider(Integer ns_id, DictionaryOf(LuaRef) opts,
String k = opts.items[i].key; String k = opts.items[i].key;
Object *v = &opts.items[i].value; Object *v = &opts.items[i].value;
size_t j; size_t j;
for (j = 0; cbs[j].name; j++) { for (j = 0; cbs[j].name && cbs[j].dest; j++) {
if (strequal(cbs[j].name, k.data)) { if (strequal(cbs[j].name, k.data)) {
if (v->type != kObjectTypeLuaRef) { if (v->type != kObjectTypeLuaRef) {
api_set_error(err, kErrorTypeValidation, api_set_error(err, kErrorTypeValidation,