From 113043aa621e4ff98e543086abb754a8100bb850 Mon Sep 17 00:00:00 2001 From: Doug Morris Date: Sun, 9 Apr 2000 07:04:24 +0000 Subject: [PATCH] bug fix - prevents core-dumping on scan -format '1' --- ChangeLog | 16 ++++++++++++++-- sbr/fmt_compile.c | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d364005..4adc15a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Sun Apr 09 13:03:59 2000 Doug Morris + + * added check in fmt_compile() to handle a single-character + format string. fmt_compile() depends on having an array of + format characters with an empty item at the end. A + single-character format would cause programs using this + function to segfault because the algorithm used to decide on + the length of the array mistakenly created a single-item array + when the format string was one character. This eventually + caused problems when the program attempted to test item+1 + in the array. + Thu Apr 06 21:53:50 2000 Dan Harkless * Richard Coleman threw out a lot of old MH-specific files in nmh. @@ -542,7 +554,7 @@ Sun Sep 12 09:19:27 1999 Doug Morris * Added check for which is the new location where linux systems appear to be stuffing this header file. -Thu Sep 9 23:15:49 1999 Doug Morris +Thu Sep 09 23:15:49 1999 Doug Morris * fixed varous mkstmep bugs introduced in 1.0.1 by me. Whups! @@ -576,7 +588,7 @@ Thu Jul 15 18:37:07 1999 Dan Harkless * Default rcvdistcomps no longer puts a copy of all outgoing messages in outbox. Added an rcvdistcomps.outbox that does. -Sat Jun 9 12:22:47 1999 Doug Morris +Sat Jun 09 12:22:47 1999 Doug Morris * Updated configure to check for mkstemp (available on OpenBSD) and substitute it for mktemp if available. diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index d3e5ea9..e857c7d 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -270,6 +270,7 @@ fmt_compile(char *fstring, struct format **fmt) * normal processing. */ i = strlen(fstring)/2 + 1; + if (i==1) i++; next_fp = formatvec = (struct format *)calloc ((size_t) i, sizeof(struct format)); if (next_fp == NULL) -- 1.7.10.4