openbsd-ports/www/clearsilver/patches/patch-util_neo_str_c

31 lines
1.0 KiB
Plaintext

$OpenBSD: patch-util_neo_str_c,v 1.1 2005/10/28 12:48:49 markus Exp $
--- util/neo_str.c.orig Thu Jul 29 00:17:42 2004
+++ util/neo_str.c Tue Oct 25 11:10:45 2005
@@ -122,7 +122,7 @@ NEOERR *string_append (STRING *str, char
l = strlen(buf);
err = string_check_length (str, l);
if (err != STATUS_OK) return nerr_pass (err);
- strcpy(str->buf + str->len, buf);
+ strlcpy(str->buf + str->len, buf, str->max - str->len);
str->len += l;
return STATUS_OK;
@@ -174,7 +174,7 @@ NEOERR *string_appendvf (STRING *str, ch
err = string_check_length (str, bl+1);
if (err != STATUS_OK) return nerr_pass (err);
va_copy(tmp, ap);
- vsprintf (str->buf + str->len, fmt, tmp);
+ vsnprintf (str->buf + str->len, str->max - str->len, fmt, tmp);
str->len += bl;
str->buf[str->len] = '\0';
@@ -579,7 +579,7 @@ char *repr_string_alloc (char *s)
rs[i++] = '\\';
break;
default:
- sprintf(&(rs[i]), "%03o", (s[x] & 0377));
+ snprintf(&(rs[i]), nl+3-i, "%03o", (s[x] & 0377));
i += 3;
break;
}