pingpong: return error when trying to send without connection

When imap_done() got called before a connection is setup, it would try
to "finish up" and dereffed a NULL pointer.

Test case 1553 managed to reproduce. I had to actually use a host name
to try to resolve to slow it down, as using the normal local server IP
will make libcurl get a connection in the first curl_multi_perform()
loop and then the bug doesn't trigger.

Fixes #1953
Assisted-by: Max Dymond
This commit is contained in:
Daniel Stenberg 2017-10-06 17:20:54 +02:00
parent 0af5ac27c3
commit 5b54df06d2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 175 additions and 4 deletions

View file

@ -169,7 +169,7 @@ test1520 test1521 \
test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \
test1533 test1534 test1535 test1536 test1537 test1538 \
test1540 \
test1550 test1551 test1552 \
test1550 test1551 test1552 test1553 \
test1600 test1601 test1602 test1603 test1604 test1605 test1606 \
\
test1700 test1701 test1702 \

52
tests/data/test1553 Normal file
View file

@ -0,0 +1,52 @@
<testcase>
<info>
<keywords>
IMAP
Clear Text
FETCH
</keywords>
</info>
#
# Server-side
<reply>
<data>
From: me@somewhere
To: fake@nowhere
body
--
yours sincerely
</data>
<datacheck>
</datacheck>
<servercmd>
</servercmd>
</reply>
#
# Client-side
<client>
<server>
imap
</server>
<name>
IMAP cleanup before a connection was created
</name>
# tool is what to use instead of 'curl'
<tool>
lib1553
</tool>
<command>
imap://non-existing-host.haxx.se:%IMAPPORT/1553
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
</protocol>
</verify>
</testcase>