Skip to content

Commit 820a4af

Browse files
committed
Correct RFH2 parsing
1 parent d16330d commit 820a4af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ibmmq/mqiRFH2.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ func getHeaderRFH2(md *MQMD, buf []byte) (*MQRFH2, int, error) {
149149
func (hdr *MQRFH2) Get(buf []byte) []string {
150150
var l int32
151151
props := make([]string, 0)
152-
r := bytes.NewBuffer(buf[MQRFH_STRUC_LENGTH_FIXED_2:])
152+
153+
r := bytes.NewBuffer(buf[MQRFH_STRUC_LENGTH_FIXED_2:hdr.StrucLength])
154+
// logTrace("RFH2 Get: Input buffer length %d Variable length %d", len(buf), r.Len())
153155

154156
propsLen := r.Len() // binary.Read modifies the buffer length so get it at the start of the loop
155157
for offset := 0; offset < propsLen; {
@@ -158,6 +160,7 @@ func (hdr *MQRFH2) Get(buf []byte) []string {
158160
s := readStringFromFixedBuffer(r, l)
159161
props = append(props, s)
160162
offset += int(l)
163+
// logTrace("RFH2 Get: propsLen=%d stringLength=%d offset=%d ", propsLen, l, offset)
161164
}
162165
return props
163166
}

0 commit comments

Comments
 (0)