On Wed, 17 May 2023 04:15:01 GMT, Xue-Lei Andrew Fan <xue...@openjdk.org> wrote:

>> This and all uses of snprintf in this change are incorrect.  If the output 
>> is truncated, snprintf returns the
>> number of characters that would have been written if there had been enough 
>> space.  That is, the result
>> may be larger than bufsize.
>
>> This and all uses of snprintf in this change are incorrect. If the output is 
>> truncated, snprintf returns the number of characters that would have been 
>> written if there had been enough space. That is, the result may be larger 
>> than bufsize.
> 
> The correctness of this change depends on the fact that the buffer has 
> sufficient capacity, which has been checked at line 230.  I agreed that this 
> is not a typical use of `snprintf` that the returned value is not checked.   
> I will make an update to check the returned value of `snprintf`.

OK, I missed that.  (The relevant code doesn't show up in the default github 
diff.  I really ought to know better
than to use that view for reviewing.)  Even having been pointed to the code, I 
had to do some counting and
such to convince myself that it was safe.  A bit of commentary might save some 
time for the next reader.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13995#discussion_r1196170575

Reply via email to