Index: ossp-pkg/lmtp2nntp/lmtp2nntp.c RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp.c,v rcsdiff -q -kk '-r1.51' '-r1.52' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp.c,v' 2>/dev/null --- 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 ) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "\"$_\"\n" };}' + * perl ) { 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] */ 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);