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:".

drh 2018-06-26 02:26 trunk
Commit 122905c29b43f5358911a0b6e5f1868b53bd9621143904864ce2442098859446
2 files changed +1 -1 +1 -1
+1 -1
--- src/blob.c
+++ src/blob.c
@@ -298,11 +298,11 @@
298298
299299
/*
300300
** Append a single character to the blob
301301
*/
302302
void blob_append_char(Blob *pBlob, char c){
303
- if( pBlob->nUsed+1>pBlob->nAlloc ){
303
+ if( pBlob->nUsed+1 >= pBlob->nAlloc ){
304304
pBlob->xRealloc(pBlob, pBlob->nUsed + pBlob->nAlloc + 100);
305305
if( pBlob->nUsed + 1 >= pBlob->nAlloc ){
306306
blob_panic();
307307
}
308308
}
309309
--- 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 @@
316316
static void append_quoted(Blob *pOut, Blob *pMsg){
317317
char *zIn = blob_str(pMsg);
318318
char c;
319319
int iCol = 0;
320320
while( (c = *(zIn++))!=0 ){
321
- if( (c>='!' && c<='~' && c!='=')
321
+ if( (c>='!' && c<='~' && c!='=' && c!=':')
322322
|| (c==' ' && zIn[0]!='\r' && zIn[0]!='\n')
323323
){
324324
blob_append_char(pOut, c);
325325
iCol++;
326326
if( iCol>=70 ){
327327
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button