[PATCH] utils: json: Fix maybe-uninitialized warning in json_parse()

Jouni Malinen j at w1.fi
Sat Oct 24 09:09:02 PDT 2026


On Fri, Sep 11, 2026 at 02:03:19AM +0530, Chaitanya Tata wrote:
> json_parse() reads num/dnum through curr_token->number/dnumber right
> after setting them based on is_double, so the value that gets read is
> always the one that was just written in the same branch. However,
> that data flow spans several nested if/else blocks and switch cases
> between the write and the read, which is enough to defeat GCC's
> flow analysis at -Os: it flags both num and dnum as possibly used
> uninitialized, which is fatal for any -Werror build.
> 
> Reproduced with plain gcc -Os -Wall -Werror=maybe-uninitialized (GCC
> 13.3.0), no special build options required. Initialize both at
> declaration to keep such builds working.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list