openbsd-ports/graphics/jpeg/patches/patch-jerror_c
brad a2563cef31 sprintf -> snprintf
From: Bruno Rohee <bruno at rohee dot com>
2005-04-03 23:26:22 +00:00

25 lines
875 B
Plaintext

$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],