fix broken snprintf patch; from maintainer Moritz Grimm <gtgbr@gmx.net>

This commit is contained in:
pvalchev 2005-08-22 23:25:39 +00:00
parent bf7cc206f8
commit 8eb9ed6e1b
2 changed files with 10 additions and 9 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.4 2005/04/19 20:03:49 sturm Exp $
# $OpenBSD: Makefile,v 1.5 2005/08/22 23:25:39 pvalchev Exp $
COMMENT= "library for communicating with an icecast server"
DISTNAME= libshout-2.1
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= net audio
HOMEPAGE= http://www.icecast.org/

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_util_c,v 1.1 2005/04/19 20:07:11 sturm Exp $
--- src/util.c.orig Sun Apr 17 12:25:31 2005
+++ src/util.c Sun Apr 17 13:55:13 2005
$OpenBSD: patch-src_util_c,v 1.2 2005/08/22 23:25:39 pvalchev Exp $
--- src/util.c.orig Sun Mar 21 05:03:34 2004
+++ src/util.c Fri Aug 19 21:04:04 2005
@@ -254,6 +254,7 @@ char *_shout_util_dict_urlencode(util_di
char *res, *tmp;
char *enc;
@ -54,7 +54,7 @@ $OpenBSD: patch-src_util_c,v 1.1 2005/04/19 20:07:11 sturm Exp $
free(enc);
}
@@ -291,14 +310,24 @@ char *_shout_util_dict_urlencode(util_di
@@ -291,14 +310,25 @@ char *_shout_util_dict_urlencode(util_di
return NULL;
}
@ -67,12 +67,13 @@ $OpenBSD: patch-src_util_c,v 1.1 2005/04/19 20:07:11 sturm Exp $
- } else
+ } else {
+ int ret;
+ size_t reslen;
res = tmp;
- sprintf(res + strlen(res), "=%s", enc);
- free(enc);
+ ret = snprintf(res + strlen(res), buflen - strlen(res),
+ "=%s", enc);
+ if (ret == -1 || ret >= buflen - strlen(res)) {
+ reslen = strlen(res);
+ ret = snprintf(res + reslen, buflen - reslen, "=%s", enc);
+ if (ret == -1 || ret >= buflen - reslen) {
+ free(enc);
+ free(res);
+ return NULL;