Protect against bad summary types user/tsbere/ignore_invalid_summary_request
authorThomas Berezansky <tsbere@mvlc.org>
Fri, 28 Mar 2014 13:27:56 +0000 (09:27 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Fri, 28 Mar 2014 13:27:56 +0000 (09:27 -0400)
Ensure that if we are asked for summary information in Patron Information that
we have any form of definition for it *and* we have code to call. If neither
case is true pretend they didn't ask for any to begin with.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Sip/MsgType.pm

index 6fb4793..1e4d00a 100644 (file)
@@ -897,6 +897,12 @@ sub summary_info {
         return '';
     }
 
+    if ($summary_type > $#summary_map || not defined $summary_map[$summary_type]->{func}) {
+        # Huh, we don't have any code to handle the requested summary information.
+        # Pretend nothing was asked for instead.
+        return '';
+    }
+
     syslog("LOG_DEBUG", "Summary_info: index == '%d', field '%s'",
           $summary_type, $summary_map[$summary_type]->{fid});