(file) Return to Strlcpy.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Executor

Diff for /pegasus/src/Executor/Strlcpy.h between version 1.4 and 1.5

version 1.4, 2008/12/02 09:00:13 version 1.5, 2013/01/10 04:53:07
Line 34 
Line 34 
  
 #include <stddef.h> #include <stddef.h>
  
 /*  
 **==============================================================================  
 **  
 ** Strlcpy()  
 **  
 **     This is an original implementation of the strlcpy() function as described  
 **     by Todd C. Miller in his popular security paper entitled "strlcpy and  
 **     strlcat - consistent, safe, string copy and concatenation".  
 **  
 **     Note that this implementation favors readability over efficiency. More  
 **     efficient implementations are possible but would be too complicated  
 **     to verify in a security audit.  
 **  
 **==============================================================================  
 */  
   
 static size_t Strlcpy(char* dest, const char* src, size_t size)  
 {  
     size_t i;  
   
     for (i = 0; src[i] && i + 1 < size; i++)  
         dest[i] = src[i];  
   
     if (size > 0)  
         dest[i] = '\0';  
   
     while (src[i])  
         i++;  
   
     return i;  
 }  
   
 #endif /* _Executor_Strlcpy_h */ #endif /* _Executor_Strlcpy_h */


Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2