summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorJohannes Obermayr <johannesobermayr@gmx.de>2012-06-28 10:16:47 +0200
committerJosé Fonseca <jfonseca@vmware.com>2012-06-28 11:47:23 +0100
commitbf679ce1dcc9cb90bb0092a550a03ad391f6ba72 (patch)
treee84dd40a1a0eaeeddb9e2b301ac373a32f864113 /src/gallium
parent1906d2b46b21a8e7496409e0639d8463ad86dcfe (diff)
gallivm: Fix potential buffer overflowing in strncat.
Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
index 16ef25a8a39..8549b87a1c7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
@@ -118,16 +118,16 @@ lp_build_print_value(struct gallivm_state *gallivm,
params[1] = lp_build_const_string(gallivm, msg);
if (length == 1) {
- util_strncat(format, type_fmt, sizeof format);
+ util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1);
params[2] = value;
} else {
for (i = 0; i < length; ++i) {
- util_strncat(format, type_fmt, sizeof format);
+ util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1);
params[2 + i] = LLVMBuildExtractElement(builder, value, lp_build_const_int32(gallivm, i), "");
}
}
- util_strncat(format, "\n", sizeof format);
+ util_strncat(format, "\n", sizeof(format) - strlen(format) - 1);
params[0] = lp_build_const_string(gallivm, format);
return lp_build_print_args(gallivm, 2 + length, params);