diff options
author | José Fonseca <[email protected]> | 2014-04-22 12:32:17 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2014-04-23 19:12:23 +0100 |
commit | 7a8667f2b34cfd1a3b01f1dbd519d03c58cec526 (patch) | |
tree | fad006f31d3c87d81970a060c430528e2c19a854 | |
parent | 05b3cea77badffa84ba0fe7b233b2be70239d618 (diff) |
util/u_debug: Pass correct size to strncat.
Courtesy of Clang static analyzer.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/util/u_debug.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index fe517175eb1..dc840e8566c 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -334,10 +334,10 @@ debug_dump_flags(const struct debug_named_value *names, while(names->name) { if((names->value & value) == names->value) { if (!first) - util_strncat(output, "|", sizeof(output)); + util_strncat(output, "|", sizeof(output) - strlen(output) - 1); else first = 0; - util_strncat(output, names->name, sizeof(output) - 1); + util_strncat(output, names->name, sizeof(output) - strlen(output) - 1); output[sizeof(output) - 1] = '\0'; value &= ~names->value; } @@ -346,12 +346,12 @@ debug_dump_flags(const struct debug_named_value *names, if (value) { if (!first) - util_strncat(output, "|", sizeof(output)); + util_strncat(output, "|", sizeof(output) - strlen(output) - 1); else first = 0; util_snprintf(rest, sizeof(rest), "0x%08lx", value); - util_strncat(output, rest, sizeof(output) - 1); + util_strncat(output, rest, sizeof(output) - strlen(output) - 1); output[sizeof(output) - 1] = '\0'; } |