antirez / antirez/lua-cmsgpack
mp_buf_append and sanitizing realloc
未关闭
- 主要语言
- C
- 星标
- 383
- 派生
- 122
- PR 合并指标
- 30 天内没有已合并 PR
描述
I noticed mp_buf_append and mp_buf_new are not sanitizing the result to [mp_realloc](https://github.com/antirez/lua-cmsgpack/blob/master/lua_cmsgpack.c#L122).
The Lua documentation states that when the pointer is non-null is must behave like realloc (and in the default case it is: `return realloc(ptr, nsize)`). In turn, when realloc fails the original block is left untouched and NULL is returned, which paths into a memcpy (and likely segmenta.... fau.. or something else entirely dependent on `buf->len`).
While a minor issue, a bit of defensive programming here would not hurt.
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。