summaryrefslogtreecommitdiff
path: root/ext/zip
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2007-02-24 16:25:58 +0000
committerMarcus Boerger <helly@php.net>2007-02-24 16:25:58 +0000
commit20a40063c51b20c1ea5f48c109b69fea3964b446 (patch)
tree24d6bf7894cc8080ff86f16eb5efef9da1cdf9c7 /ext/zip
parent10ffce328593ddda1fb31482ec5d19ce6e02556d (diff)
downloadphp-git-20a40063c51b20c1ea5f48c109b69fea3964b446.tar.gz
- avoid sprintf
Diffstat (limited to 'ext/zip')
-rw-r--r--ext/zip/lib/zip_close.c2
-rw-r--r--ext/zip/lib/zip_error_strerror.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c
index d88737ef6b..78a9ae0c9d 100644
--- a/ext/zip/lib/zip_close.c
+++ b/ext/zip/lib/zip_close.c
@@ -535,7 +535,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
return NULL;
}
- sprintf(temp, "%s.XXXXXX", za->zn);
+ snprintf(temp, sizeof(temp), "%s.XXXXXX", za->zn);
if ((tfd=mkstemp(temp)) == -1) {
_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
diff --git a/ext/zip/lib/zip_error_strerror.c b/ext/zip/lib/zip_error_strerror.c
index 3df056805e..8e4ea377fb 100644
--- a/ext/zip/lib/zip_error_strerror.c
+++ b/ext/zip/lib/zip_error_strerror.c
@@ -54,7 +54,7 @@ _zip_error_strerror(struct zip_error *err)
_zip_error_fini(err);
if (err->zip_err < 0 || err->zip_err >= _zip_nerr_str) {
- sprintf(buf, "Unknown error %d", err->zip_err);
+ snprintf(buf, sizeof(buf), "Unknown error %d", err->zip_err);
zs = NULL;
ss = buf;
}
@@ -78,11 +78,11 @@ _zip_error_strerror(struct zip_error *err)
if (ss == NULL)
return zs;
else {
- if ((s=(char *)malloc(strlen(ss)
- + (zs ? strlen(zs)+2 : 0) + 1)) == NULL)
+ int l = strlen(ss) + (zs ? strlen(zs)+2 : 0) + 1;
+ if ((s=(char *)malloc(l)) == NULL)
return _zip_err_str[ZIP_ER_MEMORY];
- sprintf(s, "%s%s%s",
+ snprintf(s, l, "%s%s%s",
(zs ? zs : ""),
(zs ? ": " : ""),
ss);