Fix potential buffer overrun in drw_shader_dependencies_get

Logical error let this function to write one past the buffer bounds.
This commit is contained in:
Campbell Barton 2021-04-30 14:27:44 +10:00
parent 0eef9df355
commit d6b26b3fa0
1 changed files with 3 additions and 3 deletions

View File

@ -606,10 +606,10 @@ static uint32_t drw_shader_dependencies_get(const DRWShaderLibrary *lib, const c
haystack += 16;
int dep = drw_shader_library_search(lib, haystack);
if (dep == -1) {
char dbg_name[32];
char dbg_name[33];
int i = 0;
while ((haystack[0] != ')') && (i < 31)) {
dbg_name[i] = haystack[0];
while ((*haystack != ')') && (i < (sizeof(dbg_name) - 2))) {
dbg_name[i] = *haystack;
haystack++;
i++;
}