Bug 934 - Default vsnprintf on solaris 8 (with cc) is broken
Default vsnprintf on solaris 8 (with cc) is broken
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: winbind
3.0.2
All Solaris
: P3 critical
: none
Assigned To: Gerald (Jerry) Carter
:
Depends on:
Blocks: 691
  Show dependency treegraph
 
Reported: 2004-01-02 13:04 UTC by Steven Tamm
Modified: 2005-08-24 10:19 UTC (History)
0 users

See Also:


Attachments
use builtin vsnprintf consistently (459 bytes, patch)
2004-07-28 17:13 UTC, James Peach (outdated mail address)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Tamm 2004-01-02 13:04:22 UTC
The default vsnprintf in solaris 8 (when using the default compiler) is broken 
(in that when you pass in NULL as the destination is automatically returns 0).  
This causes lp_string to fail and random segfaults to occur (in winbind 
particularly.  The solution I used (to try and get) was to modify vasprintf to 
call dopr directly (since the cc linker seems to always default to the standard 
one).  Once this is done, everything seems to work perfectly.
Comment 1 Steven Tamm 2004-02-09 20:48:43 UTC
*** source/lib/snprintf.c~      Fri Nov  7 09:37:35 2003
--- source/lib/snprintf.c       Mon Feb  9 20:34:24 2004
***************
*** 852,858 ****
--- 852,862 ----
  
        VA_COPY(ap2, ap);
  
+ #ifdef SUNOS5
+       ret = dopr(NULL, 0, format, ap2);
+ #else
        ret = vsnprintf(NULL, 0, format, ap2);
+ #endif
        if (ret <= 0) return ret;
  
        (*ptr) = (char *)malloc(ret+1);
Comment 2 James Peach (outdated mail address) 2004-07-28 17:13:41 UTC
Created attachment 587 [details]
use builtin vsnprintf consistently

I believe this problem is present in any 
system that doesn't do unix98 snprintf by default. This
includes IRIX and (I guess) Solaris.
Comment 3 Steven Tamm 2004-08-09 17:04:25 UTC
I think you need to also need to change the "vsnprintf" function on line
snprintf.c:824 to "smb_vsnprintf" for the given patch to work.
Comment 4 Steven Tamm 2004-08-09 18:16:41 UTC
You also need to modify talloc.c to replace vsnprintf with smb_vsnprintf;
otherwise, talloc_asnprintf fails miserably.
Comment 5 Gerald (Jerry) Carter 2004-10-29 07:34:32 UTC
James, did your patch get applied.  Can we close this one ?
Comment 6 Gerald (Jerry) Carter 2004-11-15 20:07:35 UTC
fixed in 3.0.6 according to the release notes.
Comment 7 Gerald (Jerry) Carter 2005-08-24 10:19:46 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.