diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-10-12 22:05:14 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2017-10-14 15:34:17 +0100 |
commit | acec9514b1006e352ef283f205ecec75a9b6ff0d (patch) | |
tree | 2e3960d42965fb8dc5a958f1b485d8c2b5f3a01b /src/src/malware.c | |
parent | 31beb7972466a33a88770eacbce13490f2ddadc2 (diff) | |
download | exim4-acec9514b1006e352ef283f205ecec75a9b6ff0d.tar.gz |
String handling: refactor the expanding-string routines and users to use a descriptor struct
Diffstat (limited to 'src/src/malware.c')
-rw-r--r-- | src/src/malware.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/src/malware.c b/src/src/malware.c index e39cea814..f9b99193d 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -710,6 +710,7 @@ badseek: err = errno; if (drweb_vnum) { int i; + gstring * g = NULL; /* setup default virus name */ malware_name = US"unknown"; @@ -721,7 +722,8 @@ badseek: err = errno; /* read and concatenate virus names into one string */ for (i = 0; i < drweb_vnum; i++) { - int size = 0, off = 0, ovector[10*3]; + int ovector[10*3]; + /* read the size of report */ if (!recv_len(sock, &drweb_slen, sizeof(drweb_slen), tmo)) return m_errlog_defer_3(scanent, CUS callout_address, @@ -745,16 +747,16 @@ badseek: err = errno; pcre_get_substring(CS tmpbuf, ovector, result, 1, &pre_malware_nb); if (i==0) /* the first name we just copy to malware_name */ - malware_name = string_append(NULL, &size, &off, - 1, pre_malware_nb); + g = string_cat(NULL, pre_malware_nb); + /*XXX could be string_append_listele? */ else /* concatenate each new virus name to previous */ - malware_name = string_append(malware_name, &size, &off, - 2, "/", pre_malware_nb); + g = string_append(g, 2, "/", pre_malware_nb); pcre_free_substring(pre_malware_nb); } } + malware_name = string_from_gstring(g); } else { |