From de02cf259b67707072973eea2efdd8afa9098e89 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 9 Jul 2019 11:11:57 +0300 Subject: [PATCH] shared/hfp: Fix using uninitialized value This fixes the following trace when running unit tests: at 0x409597: is_response (hfp.c:1009) by 0x409597: hf_call_prefix_handler (hfp.c:1103) by 0x409955: hf_process_input (hfp.c:1176) by 0x409955: hf_can_read_data (hfp.c:1240) by 0x40C0E8: watch_callback (io-glib.c:170) by 0x48C3EDC: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6000.3) by 0x48C426F: ??? (in /usr/lib64/libglib-2.0.so.0.6000.3) by 0x48C45A2: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6000.3) by 0x40C94C: mainloop_run (mainloop-glib.c:79) by 0x40CEF9: mainloop_run_with_signal (mainloop-notify.c:201) by 0x408A43: tester_run (tester.c:870) by 0x404E04: main (test-hfp.c:865) --- src/shared/hfp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/hfp.c b/src/shared/hfp.c index 5bddc9613..f4747b4ca 100644 --- a/src/shared/hfp.c +++ b/src/shared/hfp.c @@ -1075,7 +1075,7 @@ static void hf_call_prefix_handler(struct hfp_hf *hfp, const char *data) struct hfp_context context; enum hfp_result result; enum hfp_error cme_err; - char lookup_prefix[18]; + char lookup_prefix[18] = {}; uint8_t pref_len = 0; const char *prefix; int i; -- 2.47.3