diff options
author | Eric Engestrom <[email protected]> | 2018-09-21 12:00:33 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2018-09-25 11:39:30 +0100 |
commit | f5b41f9121c340281bf0e11dc8fd0e49d6810259 (patch) | |
tree | b6923f7f7e7e87cc18c5d14596005ad989e15c7e | |
parent | 1cc17fb731466c68586915acbb916586457b19bc (diff) |
gallivm: ensure string is null-terminated instead of assert()ing
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_printf.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index 575ebdfdf65..53c4d3cde41 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -108,9 +108,7 @@ lp_build_print_value(struct gallivm_state *gallivm, type_fmt[5] = '\0'; } else if (type_kind == LLVMIntegerTypeKind) { if (LLVMGetIntTypeWidth(type_ref) == 64) { - unsigned flen = strlen(PRId64); - assert(flen <= 3); - strncpy(type_fmt + 2, PRId64, flen); + util_snprintf(type_fmt + 2, 3, "%s", PRId64); } else if (LLVMGetIntTypeWidth(type_ref) == 8) { type_fmt[2] = 'u'; } else { |