OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/lmtp2nntp.c versions 1.51 and 1.52
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.51 -> 1.52

--- lmtp2nntp.c  2001/09/11 13:41:22     1.51
+++ lmtp2nntp.c  2001/09/12 06:53:56     1.52
@@ -164,7 +164,7 @@
 static void usage(char *command)
 {
     /*  use
-     *  perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "\"$_\"\n" };}'
+     *  perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "\"$_ \"\n" };}'
      *  to pull the USAGE string out of this source
      */
     fprintf(stderr, 
@@ -464,6 +464,15 @@
                 break;
             case 'm': /*POD [B<-m> I<mailfrom>] */
                 ctx->option_mailfrom = strdup(optarg);
+                /* protect ourselfs from the substitution of backreferences.
+                 * Missing varargs would cause segfaults.  Rewrite capturing
+                 * brackets to clustering syntax. Use poor man's s///g
+                 * simulator as current str library doesn't support global
+                 * substitution */
+                while (str_parse(ctx->option_mailfrom, "s/(.*?)\\((?!\\?:)(.*)/$1(?:$2/", &cp) > 0) {
+                    free(ctx->option_mailfrom);
+                    ctx->option_mailfrom = cp;
+                }
                 if (str_parse("<>", ctx->option_mailfrom) == -1) {
                     fprintf(stderr, "%s:Error: illegal regex \"%s\" to option -m.\n", ctx->progname, ctx->option_mailfrom);
                     exit(ERR_EXECUTION);

CVSTrac 2.0.1