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

Jeremy Allison jra at samba.org
Thu Jun 2 22:03:48 UTC 2016


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 ?

Cheers,

	Jeremy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lib-replace-snprintf-Fix-length-calculation-for-hex-.patch
Type: text/x-diff
Size: 1466 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160602/f8cd83ef/0001-lib-replace-snprintf-Fix-length-calculation-for-hex-.diff>


More information about the samba-technical mailing list