P2PS: Fix attribute addition in p2p_buf_add_service_instance()
authorStepanov, Max <Max.Stepanov@intel.com>
Tue, 23 Jun 2015 13:47:59 +0000 (13:47 +0000)
committerJouni Malinen <j@w1.fi>
Sat, 27 Jun 2015 20:54:10 +0000 (23:54 +0300)
commit8c43ef8449bd4d2d0983db394770bd73f572b12d
tree57f42b2dfb93da994d75fcd986a09bf1fea09468
parenta9ea609ce84baa001b125adc9da55e5416a96d91
P2PS: Fix attribute addition in p2p_buf_add_service_instance()

Fix a condition when Advertised Service Info Attribute is added to
a probe response in p2p_buf_add_service_instance(). The issue is
that a 'found' value is increased even if 'test' and 'adv->hash' hashes
are different. As result 'found' may have a non-zero value when an
attribute data length is 0. In this cause an empty attribute is about to
be added. Fixing it by eliminating 'found' and checking 'total_len'
containing a real number of bytes added to Advertised Service Info
Attribute.

This fixes an issue from commit 50a9efe713df135e98f2229f67faa1a3d7243693
('P2PS: Fix Probe Response frame building in error cases').

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
src/p2p/p2p_build.c