Package: mgdiff
Version: 1.0-27
Severity: normal
Tags: patch

Mgdiff will happily allow users to set '-' as both files which will not work
(since stdin is only read once) and makes it generate two temporary files
(although only the last one will be removed on exit).

The attached patch fixes this by having it reject a call of the form: 

$ msgdiff - - 

Regards

Javier
--- mgdiff-1.0-27/mgdiff.c      2005-10-22 15:24:06.000000000 +0200
+++ mgdiff-1.0/mgdiff.c 2005-10-22 15:43:13.000000000 +0200
@@ -1163,6 +1163,10 @@
         * two filenames on command line; process them
         */
     case 3:
+       if (strcmp (argv[1], "-") == 0 && strcmp (argv[1], "-") == 0) {
+               (void) fprintf (stderr, "Cannot use stdin for both file 
input\n");
+               exit (2);
+       }
        if (strcmp (argv[1], "-") == 0) {
            if (!copy_to_tempfile (stdin, tempfname, sizeof (tempfname))) {
                (void) fprintf (stderr, "Error copying stdin to temp file 
\"%s\"\n", tempfname);

Attachment: signature.asc
Description: Digital signature

Reply via email to