summaryrefslogtreecommitdiff
path: root/src/if_lua.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-26 21:44:20 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-26 21:44:20 +0100
commit6fb5c97242a151e67bd5c72736f187ef71c44e24 (patch)
treedae4bf7e06130d172f87e497b0563ddcf89eaed3 /src/if_lua.c
parentd6c3f1fa2b5e1dd7dc87cf608d72b84ad696b58f (diff)
downloadvim-git-6fb5c97242a151e67bd5c72736f187ef71c44e24.tar.gz
patch 8.1.1054: not checking return value of ga_grow()v8.1.1054
Problem: Not checking return value of ga_grow(). (Coverity) Solution: Only append when ga_grow() returns OK.
Diffstat (limited to 'src/if_lua.c')
-rw-r--r--src/if_lua.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/if_lua.c b/src/if_lua.c
index 825e8346f..cfb288522 100644
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -1144,9 +1144,9 @@ luaV_blob_add(lua_State *L)
size_t i, l = 0;
const char *s = lua_tolstring(L, 2, &l);
- ga_grow(&b->bv_ga, l);
- for (i = 0; i < l; ++i)
- ga_append(&b->bv_ga, s[i]);
+ if (ga_grow(&b->bv_ga, l) == OK)
+ for (i = 0; i < l; ++i)
+ ga_append(&b->bv_ga, s[i]);
}
lua_settop(L, 1);
return 1;
@@ -1776,9 +1776,9 @@ luaV_blob(lua_State *L)
size_t i, l = 0;
const char *s = lua_tolstring(L, 1, &l);
- ga_grow(&b->bv_ga, l);
- for (i = 0; i < l; ++i)
- ga_append(&b->bv_ga, s[i]);
+ if (ga_grow(&b->bv_ga, l) == OK)
+ for (i = 0; i < l; ++i)
+ ga_append(&b->bv_ga, s[i]);
}
}
return 1;