49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
$OpenBSD: patch-protocols_util_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
|
|
--- protocols/util.c.orig Sat Sep 11 02:03:07 2004
|
|
+++ protocols/util.c Thu Oct 14 15:43:35 2004
|
|
@@ -131,14 +131,15 @@ char *str_to_utf8(unsigned char *in)
|
|
void strip_linefeed(gchar *text)
|
|
{
|
|
int i, j;
|
|
- gchar *text2 = g_malloc(strlen(text) + 1);
|
|
+ size_t text_len = strlen(text) + 1;
|
|
+ gchar *text2 = g_malloc(text_len);
|
|
|
|
for (i = 0, j = 0; text[i]; i++)
|
|
if (text[i] != '\r')
|
|
text2[j++] = text[i];
|
|
text2[j] = '\0';
|
|
|
|
- strcpy(text, text2);
|
|
+ strlcpy(text, text2, text_len);
|
|
g_free(text2);
|
|
}
|
|
|
|
@@ -239,7 +240,6 @@ char *normalize(const char *s)
|
|
|
|
u = t = g_strdup(s);
|
|
|
|
- strcpy(t, s);
|
|
g_strdown(t);
|
|
|
|
while (*t && (x < BUF_LEN - 1)) {
|
|
@@ -304,7 +304,8 @@ static htmlentity_t ent[] =
|
|
void strip_html( char *in )
|
|
{
|
|
char *start = in;
|
|
- char *out = g_malloc( strlen( in ) + 1 );
|
|
+ size_t in_len = strlen( in ) + 1;
|
|
+ char *out = g_malloc(in_len);
|
|
char *s = out, *cs;
|
|
int i, matched;
|
|
|
|
@@ -363,7 +364,7 @@ void strip_html( char *in )
|
|
}
|
|
}
|
|
|
|
- strcpy( start, out );
|
|
+ strlcpy( start, out, in_len );
|
|
g_free( out );
|
|
}
|
|
|