Fossil SCM
Fix a critical bug in the new blob_append_char() routine that was added to the previous check-in. This bug causes crashes. Also change the quoted-printable encoding to escape the ':' character so that lines in the body of an email will never be confused with a header line like "From:".
Commit
122905c29b43f5358911a0b6e5f1868b53bd9621143904864ce2442098859446
Parent
b6a13c45bd0e59c…
2 files changed
+1
-1
+1
-1
+1
-1
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -298,11 +298,11 @@ | ||
| 298 | 298 | |
| 299 | 299 | /* |
| 300 | 300 | ** Append a single character to the blob |
| 301 | 301 | */ |
| 302 | 302 | void blob_append_char(Blob *pBlob, char c){ |
| 303 | - if( pBlob->nUsed+1>pBlob->nAlloc ){ | |
| 303 | + if( pBlob->nUsed+1 >= pBlob->nAlloc ){ | |
| 304 | 304 | pBlob->xRealloc(pBlob, pBlob->nUsed + pBlob->nAlloc + 100); |
| 305 | 305 | if( pBlob->nUsed + 1 >= pBlob->nAlloc ){ |
| 306 | 306 | blob_panic(); |
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -298,11 +298,11 @@ | |
| 298 | |
| 299 | /* |
| 300 | ** Append a single character to the blob |
| 301 | */ |
| 302 | void blob_append_char(Blob *pBlob, char c){ |
| 303 | if( pBlob->nUsed+1>pBlob->nAlloc ){ |
| 304 | pBlob->xRealloc(pBlob, pBlob->nUsed + pBlob->nAlloc + 100); |
| 305 | if( pBlob->nUsed + 1 >= pBlob->nAlloc ){ |
| 306 | blob_panic(); |
| 307 | } |
| 308 | } |
| 309 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -298,11 +298,11 @@ | |
| 298 | |
| 299 | /* |
| 300 | ** Append a single character to the blob |
| 301 | */ |
| 302 | void blob_append_char(Blob *pBlob, char c){ |
| 303 | if( pBlob->nUsed+1 >= pBlob->nAlloc ){ |
| 304 | pBlob->xRealloc(pBlob, pBlob->nUsed + pBlob->nAlloc + 100); |
| 305 | if( pBlob->nUsed + 1 >= pBlob->nAlloc ){ |
| 306 | blob_panic(); |
| 307 | } |
| 308 | } |
| 309 |
+1
-1
| --- src/email.c | ||
| +++ src/email.c | ||
| @@ -316,11 +316,11 @@ | ||
| 316 | 316 | static void append_quoted(Blob *pOut, Blob *pMsg){ |
| 317 | 317 | char *zIn = blob_str(pMsg); |
| 318 | 318 | char c; |
| 319 | 319 | int iCol = 0; |
| 320 | 320 | while( (c = *(zIn++))!=0 ){ |
| 321 | - if( (c>='!' && c<='~' && c!='=') | |
| 321 | + if( (c>='!' && c<='~' && c!='=' && c!=':') | |
| 322 | 322 | || (c==' ' && zIn[0]!='\r' && zIn[0]!='\n') |
| 323 | 323 | ){ |
| 324 | 324 | blob_append_char(pOut, c); |
| 325 | 325 | iCol++; |
| 326 | 326 | if( iCol>=70 ){ |
| 327 | 327 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -316,11 +316,11 @@ | |
| 316 | static void append_quoted(Blob *pOut, Blob *pMsg){ |
| 317 | char *zIn = blob_str(pMsg); |
| 318 | char c; |
| 319 | int iCol = 0; |
| 320 | while( (c = *(zIn++))!=0 ){ |
| 321 | if( (c>='!' && c<='~' && c!='=') |
| 322 | || (c==' ' && zIn[0]!='\r' && zIn[0]!='\n') |
| 323 | ){ |
| 324 | blob_append_char(pOut, c); |
| 325 | iCol++; |
| 326 | if( iCol>=70 ){ |
| 327 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -316,11 +316,11 @@ | |
| 316 | static void append_quoted(Blob *pOut, Blob *pMsg){ |
| 317 | char *zIn = blob_str(pMsg); |
| 318 | char c; |
| 319 | int iCol = 0; |
| 320 | while( (c = *(zIn++))!=0 ){ |
| 321 | if( (c>='!' && c<='~' && c!='=' && c!=':') |
| 322 | || (c==' ' && zIn[0]!='\r' && zIn[0]!='\n') |
| 323 | ){ |
| 324 | blob_append_char(pOut, c); |
| 325 | iCol++; |
| 326 | if( iCol>=70 ){ |
| 327 |