summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
08aad9a)
strncat(dest,src,n)
The size of dest must be at least strlen(dest)+n+1.
Signed-off-by: Karsten Keil <kkeil@suse.de>
{
case INFO_NTYPE_INTERNATIONAL:
strcpy(result, international);
{
case INFO_NTYPE_INTERNATIONAL:
strcpy(result, international);
- strncat(result, string, sizeof(result));
+ strncat(result, string, sizeof(result)-strlen(result)-1);
result[sizeof(result)-1] = '\0';
return(result);
break;
case INFO_NTYPE_NATIONAL:
strcpy(result, national);
result[sizeof(result)-1] = '\0';
return(result);
break;
case INFO_NTYPE_NATIONAL:
strcpy(result, national);
- strncat(result, string, sizeof(result));
+ strncat(result, string, sizeof(result)-strlen(result)-1);
result[sizeof(result)-1] = '\0';
return(result);
break;
result[sizeof(result)-1] = '\0';
return(result);
break;
/* safe strcat/strncat */
/* safe strcat/strncat */
-#define SCAT(dst, src) scat(dst, src, sizeof(dst))
+#define SCAT(dst, src) scat(dst, src, sizeof(dst)-strlen(dst)-1)
static inline void scat(char *dst, const char *src, unsigned int siz)
{
strncat(dst, src, siz);
static inline void scat(char *dst, const char *src, unsigned int siz)
{
strncat(dst, src, siz);