Skip to content

Commit c23ba10

Browse files
committed
PVA: Fix length minimum of 'search' message
'pvinfo' does not need to include any 'tcp' protocol and is thus shorter than previously expected minimum search message
1 parent 0f666e1 commit c23ba10

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/pva/src/main/java/org/epics/pva/common/SearchRequest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,16 @@ public String toString()
8585
public static SearchRequest decode(final InetSocketAddress from, final byte version,
8686
final int payload, final ByteBuffer buffer)
8787
{
88-
if (payload < 4+1+3+16+2+1+4+2)
88+
// pvinfo sends 0x1D=29 bytes:
89+
// Header and flags
90+
// 0000 - CA 02 00 03 1D 00 00 00 00 00 00 00 81 00 00 00 - ................
91+
// Return address
92+
// 0010 - 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 - ................
93+
// Return port uint16 0xB7C8, byte 0 protocols, uint16 0 channels
94+
// 0020 - C8 B7 00 00 00
95+
// Searches add 4 bytes for protocol (length 3) "tcp",
96+
// plus the list of names.
97+
if (payload < 4+1+3+16+2+1+2)
8998
{
9099
logger.log(Level.WARNING, "PVA client " + from + " sent only " + payload + " bytes for search request");
91100
return null;

0 commit comments

Comments
 (0)