From a2563cef31257dea7de76c5426b182fb11e796f6 Mon Sep 17 00:00:00 2001 From: brad Date: Sun, 3 Apr 2005 23:26:22 +0000 Subject: [PATCH] sprintf -> snprintf From: Bruno Rohee --- graphics/jpeg/Makefile | 4 ++-- graphics/jpeg/patches/patch-jerror_c | 24 ++++++++++++++++++++++++ graphics/jpeg/patches/patch-wrrle_c | 16 ++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 graphics/jpeg/patches/patch-jerror_c create mode 100644 graphics/jpeg/patches/patch-wrrle_c diff --git a/graphics/jpeg/Makefile b/graphics/jpeg/Makefile index ec431ae6c1f..a20b0b33808 100644 --- a/graphics/jpeg/Makefile +++ b/graphics/jpeg/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.25 2004/11/30 01:06:36 espie Exp $ +# $OpenBSD: Makefile,v 1.26 2005/04/03 23:26:22 brad Exp $ COMMENT= "IJG's JPEG compression utilities" DISTNAME= jpegsrc.v6b -PKGNAME= jpeg-6b +PKGNAME= jpeg-6bp1 CATEGORIES= graphics MASTER_SITES= ftp://ftp.uu.net/graphics/jpeg/ \ ftp://ftp.shellhung.org/pub/Mirror/enlightenment/enlightenment/libs/ diff --git a/graphics/jpeg/patches/patch-jerror_c b/graphics/jpeg/patches/patch-jerror_c new file mode 100644 index 00000000000..58f0e82cbd3 --- /dev/null +++ b/graphics/jpeg/patches/patch-jerror_c @@ -0,0 +1,24 @@ +$OpenBSD: patch-jerror_c,v 1.1 2005/04/03 23:26:22 brad Exp $ + +This one is slightly problematic, if an application +choose to allocate more room for its error buffer than +the recommanded JMSG_LENGTH_MAX the error message will +get truncated. + +There should be no loss of functionnality and I'm not +aware of any app doing that. + +--- jerror.c.orig Sun Feb 22 02:03:15 1998 ++++ jerror.c Sun Mar 27 04:01:51 2005 +@@ -190,9 +190,9 @@ format_message (j_common_ptr cinfo, char + + /* Format the message into the passed buffer */ + if (isstring) +- sprintf(buffer, msgtext, err->msg_parm.s); ++ snprintf(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s); + else +- sprintf(buffer, msgtext, ++ snprintf(buffer, JMSG_LENGTH_MAX, msgtext, + err->msg_parm.i[0], err->msg_parm.i[1], + err->msg_parm.i[2], err->msg_parm.i[3], + err->msg_parm.i[4], err->msg_parm.i[5], diff --git a/graphics/jpeg/patches/patch-wrrle_c b/graphics/jpeg/patches/patch-wrrle_c new file mode 100644 index 00000000000..96e166ac067 --- /dev/null +++ b/graphics/jpeg/patches/patch-wrrle_c @@ -0,0 +1,16 @@ +$OpenBSD: patch-wrrle_c,v 1.1 2005/04/03 23:26:22 brad Exp $ + +cmapcomment is a local array, we can use sizeof. + +--- wrrle.c.orig Sun Mar 27 03:48:15 2005 ++++ wrrle.c Sun Mar 27 03:49:32 2005 +@@ -199,7 +199,8 @@ finish_output_rle (j_decompress_ptr cinf + header.cmaplen = CMAPBITS; + header.cmap = dest->colormap; + /* Add a comment to the output image with the true colormap length. */ +- sprintf(cmapcomment, "color_map_length=%d", cinfo->actual_number_of_colors); ++ snprintf(cmapcomment, sizeof cmapcomment, ++ "color_map_length=%d", cinfo->actual_number_of_colors); + rle_putcom(cmapcomment, &header); + } +