[Openais] SaNameT to char* implementation.

Manikandan Pattabiraman mail2manikandan at gmail.com
Mon Aug 21 10:56:31 PDT 2006


All,

While I was browsing through openais sources, came across this piece of code.

" return ((char *)name->value)" will return a string, which may not be
null terminated (if len is 256),
causing many problems.


Any suggestions/comments?

Thanks
Mani.


================================
char *getSaNameT (SaNameT *name)
{
#if 0
	static char ret_name[300];

	memset (ret_name, 0, sizeof (ret_name));

	if (name->length > 299) {
		memcpy (ret_name, name->value, 299);
	} else {

		memcpy (ret_name, name->value, name->length);
	}
	return (ret_name);
#endif
// TODO
	return ((char *)name->value);

}
===============================



More information about the Openais mailing list