Mesa (mesa_7_6_branch): util: Ensure debug_dump_flags generates a null-terminated string.
Vinson Lee
vlee at kemper.freedesktop.org
Wed Dec 23 23:23:41 UTC 2009
Module: Mesa
Branch: mesa_7_6_branch
Commit: 51dcea2aac08ed68b713de0a741c782d51a5b916
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=51dcea2aac08ed68b713de0a741c782d51a5b916
Author: Vinson Lee <vlee at vmware.com>
Date: Wed Dec 23 15:19:45 2009 -0800
util: Ensure debug_dump_flags generates a null-terminated string.
---
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 96d400c..be5eb87 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)
More information about the mesa-commit
mailing list