Module: Mesa
Branch: main
Commit: ab9a9f702aa440562ed9deaca92c306782e678b7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab9a9f702aa440562ed9deaca92c306782e678b7

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Wed Jan 11 15:02:12 2023 +0100

hud: fix values printing

Oops...

Fixes: 595079c37cc ("hud: extract float printf modifer selection logic to 
helper")
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20643>

---

 src/gallium/auxiliary/hud/hud_context.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c 
b/src/gallium/auxiliary/hud/hud_context.c
index 71d34a3299a..14e53e5fe6e 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -313,9 +313,9 @@ number_to_human_readable(double num, enum 
pipe_driver_query_type type,
       d /= divisor;
       unit++;
    }
-
-   sprintf(out, get_float_modifier(d), d);
-   sprintf(out, "%s", units[unit]);
+   int n = sprintf(out, get_float_modifier(d), d);
+   if (n > 0)
+      sprintf(&out[n], "%s", units[unit]);
 }
 
 static void

Reply via email to