Hello to the entire nmh community!
Today I've finally received an email with an `.ics' and so I've
used the new `mhical'. After running it via `mhical' I've figured
out that it expected an ics file as input and after just pressing
^D I've found that mhical wasn't happy about an empty input.

To reproduce it:

 % ./mhical < /dev/null
 Segmentation fault (core dumped)
 Exit 139
 % gdb -core ./mhical.core ./mhical
 Reading symbols from ./mhical...done.
 [New process 1]
 Core was generated by `mhical'.
 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  display (nfs=<optimized out>, clines=0x0, file=0x623a98 <__sF+152>) at 
uip/mhical.c:717
 717         if (clines->next) {
 (gdb) quit

I'll attach in this email a possible trivial patch that should fix
this issue.
I have verified that it applies cleanly both to latest git version and
1.7RC1 (IMHO it's a good idea to apply it for 1.7 too).


Thank you for the attention and keep up the good work!
Avoid a possible NULL pointer dereference when mhical does not receive any input
(e.g. calling it via `mhical < /dev/null').

--- uip/mhical.c.orig	2017-08-02 03:50:07.000000000 +0000
+++ uip/mhical.c
@@ -714,7 +714,7 @@ display (FILE *file, contentline *clines
     }
 
     /* Don't call on the END:VCALENDAR line. */
-    if (clines->next) {
+    if (clines  &&  clines->next) {
       (void) fmt_scan (fmt, buffer, INT_MAX, dat, NULL);
       fputs (charstring_buffer (buffer), file);
       fmt_free (fmt, 1);
_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

Reply via email to