openbsd-ports/www/clearsilver/patches/patch-util_neo_hdf_c
2008-11-18 20:00:09 +00:00

34 lines
1.2 KiB
Plaintext

$OpenBSD: patch-util_neo_hdf_c,v 1.4 2008/11/18 20:00:09 okan Exp $
--- util/neo_hdf.c.orig Tue Mar 7 21:24:44 2006
+++ util/neo_hdf.c Mon May 8 16:57:13 2006
@@ -771,13 +771,14 @@ skip_search:
}
else if (hp->link)
{
- char *new_name = (char *) malloc(strlen(hp->value) + strlen(s) + 1);
+ size_t nn_siz = strlen(hp->value) + strlen(s) + 1;
+ char *new_name = (char *) malloc(nn_siz);
if (new_name == NULL)
{
return nerr_raise(NERR_NOMEM, "Unable to allocate memory");
}
- strcpy(new_name, hp->value);
- strcat(new_name, s);
+ strlcpy(new_name, hp->value, nn_siz);
+ strlcat(new_name, s, nn_siz);
err = _set_value (hdf, new_name, value, dup, wf, link, attr, set_node);
free(new_name);
return nerr_pass(err);
@@ -1170,8 +1171,9 @@ static NEOERR* hdf_dump_cb(HDF *hdf, con
{
if (prefix && (dtype == DUMP_TYPE_DOTTED))
{
- p = (char *) malloc (strlen(hdf->name) + strlen(prefix) + 2);
- sprintf (p, "%s.%s", prefix, hdf->name);
+ size_t need = strlen(hdf->name) + strlen(prefix) + 2;
+ p = (char *) malloc (need);
+ snprintf (p, need, "%s.%s", prefix, hdf->name);
err = hdf_dump_cb (hdf, p, dtype, lvl+1, rock, dump_cbf);
free(p);
}