gnutls-devel
[Top][All Lists]
Advanced

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

Re: GnuTLS does not build on OS X 10.6 due to incompatibility with snpri


From: Nikos Mavrogiannopoulos
Subject: Re: GnuTLS does not build on OS X 10.6 due to incompatibility with snprintf macro
Date: Sat, 15 Jan 2011 14:08:43 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

On 12/29/2010 05:26 AM, Camillo Lugaresi wrote:
> Code built with gcc on Mac OS X 10.6 uses the object size checking feature of 
> gcc by default 
> (<http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html>). This 
> involves redefining several functions as macros; one of these functions is 
> snprintf:
> 
>       #define snprintf(str, len, ...) \
>        __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
> 
> The usage of snprintf in src/serv.c in gnutls-2.10.4 is not compatible with 
> that macro. serv.c attempts to use a macro (tmp2) that expands into two 
> different arguments:
> 
>       #define tmp2 &http_buffer[strlen(http_buffer)], len-strlen(http_buffer)
> 
>       snprintf (tmp2, "%.2X", sesid[i]);
> 
> Due to how nested macro evaluation works, the snprintf macro sees tmp2 as a 
> single argument, and copies it into __darwin_obsz(); then, when tmp2 is 
> expanded, __darwin_obsz has two arguments, but it is only defined for one, 
> and the result is a compilation error.
> One way to work around this issue might be to define _FORTIFY_SOURCE=0 so 
> that the snprintf macro is not defined, or simply doing an #undef snprintf 
> for that file, but it seems safer and more portable to split tmp2 into two 
> macros. I append a patch that does so.

Hi,
 I've applied a fix in the repository. Thank you for reporting that.

regards,
Nikos



reply via email to

[Prev in Thread] Current Thread [Next in Thread]