diff options
author | Vinson Lee <[email protected]> | 2009-12-23 15:19:45 -0800 |
---|---|---|
committer | Vinson Lee <[email protected]> | 2009-12-23 15:19:45 -0800 |
commit | 51dcea2aac08ed68b713de0a741c782d51a5b916 (patch) | |
tree | 3a8e062ec58d0adbce01ad7bd3ced33401b15ffd | |
parent | 2ea061509ddab9054514ad87f28de950fb30dba1 (diff) |
util: Ensure debug_dump_flags generates a null-terminated string.
-rw-r--r-- | src/gallium/auxiliary/util/u_debug.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 96d400c839b..be5eb87e474 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -452,7 +452,8 @@ debug_dump_flags(const struct debug_named_value *names, util_strncat(output, "|", sizeof(output)); else first = 0; - util_strncat(output, names->name, sizeof(output)); + util_strncat(output, names->name, sizeof(output) - 1); + output[sizeof(output) - 1] = '\0'; value &= ~names->value; } ++names; @@ -465,7 +466,8 @@ debug_dump_flags(const struct debug_named_value *names, first = 0; util_snprintf(rest, sizeof(rest), "0x%08lx", value); - util_strncat(output, rest, sizeof(output)); + util_strncat(output, rest, sizeof(output) - 1); + output[sizeof(output) - 1] = '\0'; } if(first) |