projects
/
fido.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4fe26ee
)
FTNMAIL: don't die on invalid filenames
master
author
Sebastian
<basti@notizbuch>
Tue, 30 Jun 2015 20:27:28 +0000
(22:27 +0200)
committer
Sebastian
<basti@notizbuch>
Tue, 30 Jun 2015 20:27:28 +0000
(22:27 +0200)
modules/FTNMAIL.pm
patch
|
blob
|
history
diff --git
a/modules/FTNMAIL.pm
b/modules/FTNMAIL.pm
index ac3d0a1ca0211ac820fb58866751ce05769d02bf..40e2a80f260d32fe8db4c07b808b0f143a7f3b30 100644
(file)
--- a/
modules/FTNMAIL.pm
+++ b/
modules/FTNMAIL.pm
@@
-190,11
+190,21
@@
sub unpack_packet($)
my $file = shift;
my $buf, my @mails;
my $file = shift;
my $buf, my @mails;
- die("No filename!") unless($file);
- open(PKT, '<', $file) or die("Can't open $file!\n");
+ if(!$file) {
+ LOG::warn("No filename!");
+ return;
+ }
+
+ if(!(open(PKT, '<', $file))) {
+ LOG::warn("Can't open $file!");
+ return;
+ }
binmode(PKT);
binmode(PKT);
- die("Short packet!") if(read(PKT, $buf, 0x3a) != 0x3a);
+ if(read(PKT, $buf, 0x3a) != 0x3a) {
+ LOG::warn("Short packet!");
+ return;
+ }
# parse packet header
my ($onode, $dnode, $year, $month, $day, $hour, $minute, $second,
# parse packet header
my ($onode, $dnode, $year, $month, $day, $hour, $minute, $second,
@@
-203,7
+213,10
@@
sub unpack_packet($)
$ozone, $dzone, $opoint, $dpoint, $data) = unpack(
"v v v v v v v v v v v v C C Z8 v v v n C C v v v v v a4", $buf);
$ozone, $dzone, $opoint, $dpoint, $data) = unpack(
"v v v v v v v v v v v v C C Z8 v v v n C C v v v v v a4", $buf);
- die("Unsupported packet type $type!") unless($type == 2);
+ if($type != 2) {
+ LOG::warn("Unsupported packet type $type!");
+ return;
+ }
my %packet;
if(($cw == $cwcopy) && ($cw != 0) && ($cw & 0x0001)) {
my %packet;
if(($cw == $cwcopy) && ($cw != 0) && ($cw & 0x0001)) {
@@
-227,17
+240,24
@@
sub unpack_packet($)
# read packed messages
while(1) {
# read packed messages
while(1) {
- die("Short packet!") if(read(PKT, $buf, 2) != 2);
+ if(read(PKT, $buf, 2) != 2) {
+ LOG::warn("Short packet!");
+ return;
+ }
my $type = unpack("v", $buf);
if($type == 0) {
close(PKT);
return(@mails);
} elsif($type != 2) {
my $type = unpack("v", $buf);
if($type == 0) {
close(PKT);
return(@mails);
} elsif($type != 2) {
- die("Unsupported message type $type!");
+ LOG::warn("Unsupported message type $type!");
+ return;
}
}
- die("Short packet!") if(read(PKT, $buf, 0x20) != 0x20);
+ if(read(PKT, $buf, 0x20) != 0x20) {
+ LOG::warn("Short packet!");
+ return;
+ }
# parse message header
my ($tname, $fname, $subj, $text);
# parse message header
my ($tname, $fname, $subj, $text);