Subject: | Wrong pack template used in sub |
Date: | Mon, 20 Jan 2014 19:26:31 +0000 |
To: | "bug-Net-SMPP [...] rt.cpan.org" <bug-Net-SMPP [...] rt.cpan.org> |
From: | "UNGER, SETH" <su180a [...] att.com> |
I have noticed that the wrong pack template is used in the encode_submit_resp_v34 subroutine. When trying to use deliver_sm_resp, there was an extra octet of zeros being sent due to template Z being used instead of a. See below the original and then the updated section with template a being used. This corrected the response and no longer sends the malformed packet.
sub encode_submit_resp_v34 {
my $me = $_[0];
my ($message_id);
for (my $i=1; $i <= $#_; $i+=2) {
next if !defined $_[$i];
if ($_[$i] eq 'message_id') { $message_id = splice @_,$i,2,undef,undef; }
}
warn "message_id=$message_id" if $trace;
croak "message_id must be supplied" if !defined $message_id;
return pack('Z*', $message_id);
}
Updated:
sub encode_submit_resp_v34 {
my $me = $_[0];
my ($message_id);
for (my $i=1; $i <= $#_; $i+=2) {
next if !defined $_[$i];
if ($_[$i] eq 'message_id') { $message_id = splice @_,$i,2,undef,undef; }
}
warn "message_id=$message_id" if $trace;
croak "message_id must be supplied" if !defined $message_id;
return pack('a*', $message_id);
}
-Seth Unger