From: Thomas Berezansky Date: Fri, 28 Mar 2014 13:27:56 +0000 (-0400) Subject: LP#1298985: Protect against bad summary types X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=667084c63d113c32c6a8f2bd03d613ae57fe4b2d;p=working%2FSIPServer.git LP#1298985: Protect against bad summary types 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. Testing notes ------------- Here is an example of the sort of request that, prior to this patch, could cause a SIPServer backend to crash: 6300020150615 111700 Y AOUinst|AAuser| Signed-off-by: Thomas Berezansky Signed-off-by: Galen Charlton --- diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm index 779d41d..afada58 100644 --- a/Sip/MsgType.pm +++ b/Sip/MsgType.pm @@ -929,6 +929,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});