X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fsieve.c;h=96344c416d33fa2dc1f46eebad5a514b6e9beeb5;hb=560e71cc545182bb51a7d038ac40eebac8e045aa;hp=c53db373235c3fa1aaa0450e2808d211bd2a6d75;hpb=c2f669a4994192344613569e198c7b503d46d45e;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/sieve.c b/src/src/sieve.c index c53db3732..96344c416 100644 --- a/src/src/sieve.c +++ b/src/src/sieve.c @@ -413,7 +413,8 @@ Returns static int parse_mailto_uri(struct Sieve *filter, const uschar *uri, string_item **recipient, struct String *header, struct String *subject, struct String *body) { const uschar *start; -struct String to,hname,hvalue; +struct String to, hname; +struct String hvalue = {NULL, 0}; int capacity; string_item *new; @@ -422,6 +423,7 @@ if (Ustrncmp(uri,"mailto:",7)) filter->errmsg=US "Unknown URI scheme"; return 0; } + uri+=7; if (*uri && *uri!='?') for (;;) @@ -1704,12 +1706,13 @@ Returns: 1 success -1 no string list found */ -static int parse_stringlist(struct Sieve *filter, struct String **data) +static int +parse_stringlist(struct Sieve *filter, struct String **data) { const uschar *orig=filter->pc; -int dataCapacity=0; -int dataLength=0; -struct String *d=(struct String*)0; +int dataCapacity = 0; +int dataLength = 0; +struct String *d = NULL; int m; if (*filter->pc=='[') /* string list */ @@ -1718,20 +1721,18 @@ if (*filter->pc=='[') /* string list */ for (;;) { if (parse_white(filter)==-1) goto error; - if ((dataLength+1)>=dataCapacity) /* increase buffer */ + if (dataLength+1 >= dataCapacity) /* increase buffer */ { struct String *new; int newCapacity; /* Don't amalgamate with next line; some compilers grumble */ - newCapacity=dataCapacity?(dataCapacity*=2):(dataCapacity=4); - if ((new=(struct String*)store_get(sizeof(struct String)*newCapacity))==(struct String*)0) - { - filter->errmsg=CUstrerror(errno); - goto error; - } + + dataCapacity = dataCapacity ? dataCapacity * 2 : 4; + new = store_get(sizeof(struct String) * dataCapacity); + if (d) memcpy(new,d,sizeof(struct String)*dataLength); - d=new; - dataCapacity=newCapacity; + d = new; } + m=parse_string(filter,&d[dataLength]); if (m==0) { @@ -3103,7 +3104,7 @@ while (*filter->pc) message.character=US"Notification"; message.length=Ustrlen(message.character); } - /* Allocation is larger than neccessary, but enough even for split MIME words */ + /* Allocation is larger than necessary, but enough even for split MIME words */ buffer_capacity=32+4*message.length; buffer=store_get(buffer_capacity); if (message.length!=-1) fprintf(f,"Subject: %s\n",parse_quote_2047(message.character, message.length, US"utf-8", buffer, buffer_capacity, TRUE)); @@ -3355,7 +3356,7 @@ while (*filter->pc) addr->reply->from = expand_string(US"$local_part@$domain"); else addr->reply->from = from.character; - /* Allocation is larger than neccessary, but enough even for split MIME words */ + /* Allocation is larger than necessary, but enough even for split MIME words */ buffer_capacity=32+4*subject.length; buffer=store_get(buffer_capacity); /* deconst cast safe as we pass in a non-const item */