[PATCH] Fix printf length calculation for hex/octal 64-bit values

Michael Adam obnox at samba.org
Thu Jun 2 22:12:03 UTC 2016


On 2016-06-02 at 15:03 -0700, Jeremy Allison wrote:
> From the bug report:
> 
> i,
> 
> On AIX platform, I got different problems using smbd that seemed to be related with OpLocks
> 
> With some debugging, I could track it down to 'messaging_dgm_lockfile_create': the value written into file /var/run/sambalocks/msg.lock/PID is sometimes one digit shorter than the actual value of 'unique': the first digits get losts, eg:
> unique=17299420435556398153, written=7299420435556398153.
> 
> With some more debugging, I found out that 'smbd' uses an own version of 'snprintf' that has a problem with large numbers; to be more precise buffer 'convert' in function 'fmtint' of 'lib/replace/snprintf.c' is too small; so the most signification digit gets lost.
> 
> I'm attaching a trivial patch to fix the problem (the length of buffer becomes to 22 to support octal values too).
> 
> Yours: Lorinczy Zsigmond
> 
> ----------------------------
> 
> Reviewed-by: Jeremy Allison <jra at samba.org>
> 
> Can I get a second Team reviewer ?

LGTM - pushed

Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160603/52040248/signature.sig>


More information about the samba-technical mailing list