From: Glenn Burkhardt Date: Tue, 30 Sep 2003 14:36:04 +0000 (+0000) Subject: [bug #4297] The strlen mh-format function can crash if 'str' is null. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/0e02bd46c1b4931073f3e865bbad4deb15691fd7?ds=sidebyside [bug #4297] The strlen mh-format function can crash if 'str' is null. --- diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 0a2397ba..4f79bf6a 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -511,7 +511,10 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat) value = dat[fmt->f_value]; break; case FT_LV_STRLEN: - value = strlen(str); + if (str != NULL) + value = strlen(str); + else + value = 0; break; case FT_LV_CHAR_LEFT: value = width - (cp - scanl);