From: Vasiljevic Z. <zv...@ar...> - 2009-02-05 13:00:49
|
Hi! It seems that we have problems if Dev logging is enabled. By definition the ConfigGet may return NULL. Also the value of the section param passed to this (below) and other similar functions may also be NULL. In such cases the Ns_Log below crashes at dereferencing section and/or value ptrs. CONST char * Ns_ConfigString(CONST char *section, CONST char *key, CONST char *def) { CONST char *value; value = ConfigGet(section, key, 0, def); Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", section, key, value, def); return value ? value : def; } |
From: Vasiljevic Z. <zv...@ar...> - 2009-02-05 14:21:37
|
Even worse, the "def" argument may also be NULL. Throughout in this file the: > Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", > section, key, value, def); should be changed to something like > Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", > section ? section : "", key, value ? value : "", def ? > def : ""); On 05.02.2009, at 14:00, Vasiljevic Zoran wrote: > Hi! > > It seems that we have problems if Dev logging is enabled. > By definition the ConfigGet may return NULL. Also the value > of the section param passed to this (below) and other > similar functions may also be NULL. In such cases the > Ns_Log below crashes at dereferencing section and/or value > ptrs. > > > CONST char * > Ns_ConfigString(CONST char *section, CONST char *key, CONST char *def) > { > CONST char *value; > > value = ConfigGet(section, key, 0, def); > Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", > section, key, value, def); > > return value ? value : def; > } > > > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with > Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills > and code to > build responsive, highly engaging applications that combine the > power of local > resources and data with the reach of the web. Download the Adobe AIR > SDK and > Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel |
From: Vlad S. <vl...@cr...> - 2009-02-05 16:55:44
|
On Linux it just should show null because underlying snprintf handles NULLs pretty well Vasiljevic Zoran wrote: > Hi! > > It seems that we have problems if Dev logging is enabled. > By definition the ConfigGet may return NULL. Also the value > of the section param passed to this (below) and other > similar functions may also be NULL. In such cases the > Ns_Log below crashes at dereferencing section and/or value > ptrs. > > > CONST char * > Ns_ConfigString(CONST char *section, CONST char *key, CONST char *def) > { > CONST char *value; > > value = ConfigGet(section, key, 0, def); > Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", > section, key, value, def); > > return value ? value : def; > } > > > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills and code to > build responsive, highly engaging applications that combine the power of local > resources and data with the reach of the web. Download the Adobe AIR SDK and > Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > |
From: Vasiljevic Z. <zv...@ar...> - 2009-02-05 17:08:33
|
On 05.02.2009, at 17:47, Vlad Seryakov wrote: > On Linux it just should show null because underlying snprintf > handles NULLs pretty well On Solaris, it cores all arround. |
From: Vlad S. <vl...@cr...> - 2009-02-05 17:10:57
|
The reason i think because Ns_DStringPrintf now uses OS's snprintf, before that it uses home-grown sprintf-like engine. Vasiljevic Zoran wrote: > On 05.02.2009, at 17:47, Vlad Seryakov wrote: > >> On Linux it just should show null because underlying snprintf >> handles NULLs pretty well > > > On Solaris, it cores all arround. > > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills and code to > build responsive, highly engaging applications that combine the power of local > resources and data with the reach of the web. Download the Adobe AIR SDK and > Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > |
From: Vasiljevic Z. <zv...@ar...> - 2009-02-05 17:21:51
|
On 05.02.2009, at 18:14, Vlad Seryakov wrote: > The reason i think because Ns_DStringPrintf now uses OS's snprintf, > before that it uses home-grown sprintf-like engine. > Most probably. But that will not help us of course. I will need to learn this brave new code repository thing... Cheers Zoran |
From: Stephen D. <sd...@gm...> - 2009-02-05 18:18:12
|
On Thu, Feb 5, 2009 at 5:21 PM, Vasiljevic Zoran <zv...@ar...> wrote: > > On 05.02.2009, at 18:14, Vlad Seryakov wrote: > >> The reason i think because Ns_DStringPrintf now uses OS's snprintf, >> before that it uses home-grown sprintf-like engine. Yeah, all uses of printf-like functions throughout the code base need to be checked. I know at least I've been sloppy about this. > Most probably. But that will not help us of course. > I will need to learn this brave new code > repository thing... Don't forget to sign up with bitbucket.org and tell me your username. You'll be able to clone (checkout) and commit (locally) no problem as is, but you need to be authorized to push back. |
From: Vlad S. <vl...@cr...> - 2009-02-05 19:27:47
|
simple macro like #define NS_STR(s) (s != NULL ? s : "") can be used instead of using ?: every time Stephen Deasey wrote: > On Thu, Feb 5, 2009 at 5:21 PM, Vasiljevic Zoran <zv...@ar...> wrote: >> On 05.02.2009, at 18:14, Vlad Seryakov wrote: >> >>> The reason i think because Ns_DStringPrintf now uses OS's snprintf, >>> before that it uses home-grown sprintf-like engine. > > > Yeah, all uses of printf-like functions throughout the code base need > to be checked. I know at least I've been sloppy about this. > > >> Most probably. But that will not help us of course. >> I will need to learn this brave new code >> repository thing... > > > Don't forget to sign up with bitbucket.org and tell me your username. > > You'll be able to clone (checkout) and commit (locally) no problem as > is, but you need to be authorized to push back. > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills and code to > build responsive, highly engaging applications that combine the power of local > resources and data with the reach of the web. Download the Adobe AIR SDK and > Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > |
From: Vasiljevic Z. <zv...@ar...> - 2009-02-05 19:28:39
|
On 05.02.2009, at 20:30, Vlad Seryakov wrote: > simple macro like #define NS_STR(s) (s != NULL ? s : "") > can be used instead of using ?: every time I buy that. |
From: Stephen D. <sd...@gm...> - 2009-02-05 19:51:20
|
On Thu, Feb 5, 2009 at 7:28 PM, Vasiljevic Zoran <zv...@ar...> wrote: > > On 05.02.2009, at 20:30, Vlad Seryakov wrote: > >> simple macro like #define NS_STR(s) (s != NULL ? s : "") >> can be used instead of using ?: every time > > I buy that. I dunno, seems a bit gratuitous. You can't tell what the code does just by looking at it, and maybe the default shouldn't be "" ? Maybe it's just a code formatting issue: >> Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", >> section, key, value, def); > > should be changed to something like > >> Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", >> section ? section : "", key, value ? value : "", def ? def : ""); If we limit ourselves to gcc: Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", section ?: "", key, value ?: "", def ?: ""); (Our Windows build works with gcc only now, I think). |
From: Vasiljevic Z. <zv...@ar...> - 2009-02-05 19:53:29
|
On 05.02.2009, at 20:51, Stephen Deasey wrote: > If we limit ourselves to gcc: > > > Ns_Log(Dev, "config: %s:%s value=\"%s\" default=\"%s\" (string)", > section ?: "", key, value ?: "", def ?: ""); > > > (Our Windows build works with gcc only now, I think). Please don't! We use VCC+ to compile windows-port! I mean I do not have really nothing against NS_STR or a?a:"" whatever... just do not nail to GCC. No good. |