Commit 078026cd 078026cd916a733b72f64f54379fba4dc777525b by Sergey Poznyakoff

(pop3d_readline): Bugfix: add terminating zero, and check return value from gnutls_record_recv.

1 parent 595801aa
...@@ -223,7 +223,15 @@ pop3d_readline (char *buffer, size_t size) ...@@ -223,7 +223,15 @@ pop3d_readline (char *buffer, size_t size)
223 #ifdef WITH_TLS 223 #ifdef WITH_TLS
224 if (tls_done) 224 if (tls_done)
225 { 225 {
226 gnutls_record_recv (sfile, buffer, size - 1); 226 int rc = gnutls_record_recv (sfile, buffer, size - 1);
227 if (rc < 0)
228 {
229 syslog (LOG_ERR, _("TLS error on read: %s"),
230 gnutls_strerror (rc));
231 pop3d_abquit (ERR_TLS_IO);
232 }
233 else
234 buffer[rc] = 0;
227 ptr = buffer; 235 ptr = buffer;
228 } 236 }
229 else 237 else
......