]> diplodocus.org Git - nmh/blobdiff - sbr/seq_setunseen.c
Fix invalid pointer arithmetic.
[nmh] / sbr / seq_setunseen.c
index 906b0ac252a95cbe484e81551f5db84bd71ca1a8..acba9d96853c9c7a99d714565a744883adba5f07 100644 (file)
@@ -1,12 +1,13 @@
-
-/*
- * seq_setunseen.c -- add/delete all messages which have the SELECT_UNSEEN
+/* seq_setunseen.c -- add/delete all messages which have the SELECT_UNSEEN
  *                 -- bit set to/from the Unseen-Sequence
  *
- * $Id$
+ * This code is Copyright (c) 2002, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 
 /*
  * We scan through the folder and act upon all messages
@@ -26,14 +27,12 @@ seq_setunseen (struct msgs *mp, int seen)
      * Get the list of sequences for Unseen-Sequence
      * and split them.
      */
-    if ((cp = context_find (usequence))) {
-       dp = getcpy (cp);
-       if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
-           free (dp);
-           return;
-       }
-    } else {
-       return;
+    if (!(cp = context_find (usequence)))
+        return;
+    dp = mh_xstrdup(cp);
+    if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
+        free (dp);
+        return;
     }
 
     /*