Re: [PATCH] xfs: Use scnprintf() for avoiding potential buffer overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Mar 2020 19:21:36 +0100,
Darrick J. Wong wrote:
> 
> On Wed, Mar 11, 2020 at 10:35:52AM +0100, Takashi Iwai wrote:
> > Since snprintf() returns the would-be-output size instead of the
> > actual output size, the succeeding calls may go beyond the given
> > buffer limit.  Fix it by replacing with scnprintf().
> 
> > Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
> 
> The 'c' in 'scnprintf' means that it returns the number of bytes written
> into the buffer (not including the \0) instead of the number of bytes
> that /would/ have been written provided there was enough space, right?

Yes.


Takashi



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux