strncpy(buf,s,size-1); buf[size-1]='\0';
if(strlen(s) >= size) return NULL; strcpy(buf,s);
const char *RAND_file_name(char *buf, size_t size)	{	char *s=NULL;	char *ret=NULL;	if (OPENSSL_issetugid() == 0)		s=getenv("RANDFILE");	if (s != NULL)		{		strncpy(buf,s,size-1);		buf[size-1]='\0';		ret=buf;		}	else		{		if (OPENSSL_issetugid() == 0)			s=getenv("HOME");#ifdef DEFAULT_HOME		if (s == NULL)			{			s = DEFAULT_HOME;			}#endif		if (s != NULL && (strlen(s)+strlen(RFILE)+2 < size))			{			strcpy(buf,s);#ifndef OPENSSL_SYS_VMS			strcat(buf,"/");#endif			strcat(buf,RFILE);			ret=buf;			}		else		  	buf[0] = '\0'; /* no file name */		}	return(ret);	}