Commit 4f683f01d4d3cbdf83fd01a59ed730cb9f3f760b

Sam Lantinga 2021-11-26T17:26:42

Fixed potentially truncated entry in stack trace

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c
index e49bd60..b7f8030 100644
--- a/src/test/SDL_test_memory.c
+++ b/src/test/SDL_test_memory.c
@@ -104,13 +104,13 @@ static void SDL_TrackAllocation(void *mem, size_t size)
         stack_index = 0;
         while (unw_step(&cursor) > 0) {
             unw_word_t offset, pc;
-            char sym[256];
+            char sym[236];
 
             unw_get_reg(&cursor, UNW_REG_IP, &pc);
             entry->stack[stack_index] = pc;
 
             if (unw_get_proc_name(&cursor, sym, sizeof(sym), &offset) == 0) {
-                snprintf(entry->stack_names[stack_index], sizeof(entry->stack_names[stack_index]), "%s+0x%llx", sym, (unsigned long long)offset);
+                SDL_snprintf(entry->stack_names[stack_index], sizeof(entry->stack_names[stack_index]), "%s+0x%llx", sym, (unsigned long long)offset);
             }
             ++stack_index;