VOL-1952 return error if message has missing field

Change-Id: Iaa07f736aa517b793c633d6762933e12488ec7f5
diff --git a/internal/pkg/afrouter/source-router.go b/internal/pkg/afrouter/source-router.go
index 61754b3..3366dd8 100644
--- a/internal/pkg/afrouter/source-router.go
+++ b/internal/pkg/afrouter/source-router.go
@@ -198,6 +198,11 @@
 	b := proto.NewBuffer([]byte{})
 	//b.DebugPrint("The Buffer", payload)
 	for { // Find the route selector field
+		if idx >= len(payload) {
+			err := fmt.Errorf("At end of message, attribute %d not found", fieldId)
+			return "", err
+		}
+
 		log.Debugf("Decoding source value attributeNumber: %d from %v at index %d", fieldId, payload, idx)
 		log.Debugf("Attempting match with payload: %d, methodTable: %d", payload[idx], fieldId)
 		if payload[idx]>>3 == fieldId {