]> granicus.if.org Git - sudo/commitdiff
Fix setting of mailer argv[0] to basename of mailerpath.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 13 Aug 2013 20:53:55 +0000 (14:53 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 13 Aug 2013 20:53:55 +0000 (14:53 -0600)
No need to strdup() mailerpath as it is not modified.

plugins/sudoers/logging.c

index a53581d9412891bc4e3561bf4e516e69020bef0f..2b4c48b7c92c8c72e1b16698a2004839a647c5d4 100644 (file)
@@ -640,7 +640,7 @@ send_mail(const char *fmt, ...)
        case 0:
            {
                char *argv[MAX_MAILFLAGS + 1];
-               char *mpath, *mflags;
+               char *mflags, *mpath = def_mailerpath;
                int i;
 
                /* Child, set stdin to output side of the pipe */
@@ -657,8 +657,7 @@ send_mail(const char *fmt, ...)
 
                /* Build up an argv based on the mailer path and flags */
                mflags = estrdup(def_mailerflags);
-               mpath = estrdup(def_mailerpath);
-               if ((argv[0] = strrchr(mpath, ' ')))
+               if ((argv[0] = strrchr(mpath, '/')))
                    argv[0]++;
                else
                    argv[0] = mpath;