3
# DP: Prevent buffer overflow in capi20_{cmsg,message}2str.
4
# DP: Add warning that they are not thread-safe.
7
if [ $# -eq 3 -a "$2" = '-d' ]; then
10
elif [ $# -ne 1 ]; then
11
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
16
patch $pdir -f --no-backup-if-mismatch -p0 < $0
19
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
22
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
27
--- capi20/capiutils.h~ 2005-03-08 07:26:47.000000000 +0000
28
+++ capi20/capiutils.h 2007-02-17 20:22:48.000000000 +0000
30
#define capi20_cmd2str capi_cmd2str
31
char *capi_cmd2str(_cbyte cmd, _cbyte subcmd);
34
+ * WARNING: The following two functions use a single static buffer and
35
+ * are not thread-safe.
37
#define capi20_cmsg2str capi_cmsg2str
38
char *capi_cmsg2str(_cmsg * cmsg);
40
--- capi20/convert.c~ 2005-05-09 09:23:01.000000000 +0100
41
+++ capi20/convert.c 2007-02-17 20:34:17.000000000 +0000
43
static void bufprint(char *fmt,...)
46
+ size_t space = buf + sizeof(buf) - p, len;
48
- vsprintf(p, fmt, f);
49
+ len = vsnprintf(p, space, fmt, f);
52
+ if (len < space - 1)
58
static void printstructlen(_cbyte * m, unsigned len)