Bug 478 - vsnprintf overrides standard library function name
vsnprintf overrides standard library function name
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient
All Solaris
: P3 normal
: none
Assigned To: Samba Bugzilla Account
Depends on:
  Show dependency treegraph
Reported: 2003-09-19 04:06 UTC by Aleksey Studnev
Modified: 2005-08-24 10:26 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Aleksey Studnev 2003-09-19 04:06:47 UTC
It is a subtle defect with function:
int vsnprintf (char *str, size_t count, const char *fmt, va_list args)

which is defined in module lib/snprintf.c
If compiler is not compliant with C99, then this function is defined and
overrides standard implementation.
Defect happens when you try to link Samba library with any program which loads
standard libraries and uses standard vsnprintf. Solaris loads function only 
once, so Samba appears to use _standard_ function, not which is defined in 
Defect happens only if Samba library is loaded after program uses this 
Simple workaround to this is to change the name of this function to something 
int smb_vsnprintf (char *str, size_t count, const char *fmt, va_list args)

and then use
#define vsnprintf smb_vsnprintf

By the way, other "printf" functions are substituted in this (correct) way.
Comment 1 Jelmer Vernooij 2004-06-10 12:13:15 UTC
Fixed in SVN. Thanks for reporting!
Comment 2 Gerald (Jerry) Carter 2005-02-07 09:06:29 UTC
originally reported against one of the 3.0.0rc[1-4] releases.
Cleaning up non-production versions.
Comment 3 Gerald (Jerry) Carter 2005-08-24 10:26:10 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.