Commit 9a85b9aa 9a85b9aa8fe0e9de86801fa75eb276cca78421e7 by Sergey Poznyakoff

parse822_word(): Additional check for qstr != NULL:

parse822_quoted_string() sometimes returns EOK and does not fill
qstr (e.g. when parsing empty string: "")
1 parent 47546d96
...@@ -466,7 +466,7 @@ int parse822_quoted_string(const char** p, const char* e, char** qstr) ...@@ -466,7 +466,7 @@ int parse822_quoted_string(const char** p, const char* e, char** qstr)
466 } else if(c == '\\') { 466 } else if(c == '\\') {
467 rc = parse822_quoted_pair(p, e, qstr); 467 rc = parse822_quoted_pair(p, e, qstr);
468 } else if(c == '\r') { 468 } else if(c == '\r') {
469 /* invalid character... */ 469 /* invalid character... */
470 *p += 1; 470 *p += 1;
471 } else if(parse822_is_char(c)) { 471 } else if(parse822_is_char(c)) {
472 rc = str_append_char(qstr, c); 472 rc = str_append_char(qstr, c);
...@@ -498,7 +498,7 @@ int parse822_word(const char** p, const char* e, char** word) ...@@ -498,7 +498,7 @@ int parse822_word(const char** p, const char* e, char** word)
498 498
499 { 499 {
500 char* qstr = 0; 500 char* qstr = 0;
501 if((rc = parse822_quoted_string(p, e, &qstr)) == EOK) { 501 if((rc = parse822_quoted_string(p, e, &qstr)) == EOK && qstr) {
502 rc = str_append(word, qstr); 502 rc = str_append(word, qstr);
503 503
504 str_free(&qstr); 504 str_free(&qstr);
......