[Interest] QStringBuilder buffer overflow with string litteral?

Robert Hairgrove evorgriahr at hispeed.ch
Mon Jan 25 15:46:34 CET 2021


+1 ... this has indeed bitten me more times than I like to admit!

Bob Hairgrove

--

On 25.01.21 15:27, Giuseppe D'Angelo via Interest wrote:
> Hi,
>
> Il 25/01/21 13:56, Olivier B. ha scritto:
>>          fields += (fields.isEmpty() ? "" : ", ") + '"' + field + '"';
>
> QStringBuilder usage is a red herring, pay close attention at what 
> you're doing in the first +: you're summing a const char * (result of 
> the ternary operator) with a char; that does not do string 
> concatenation...
>
>


More information about the Interest mailing list