diff options
author | Thierry Vignaud <tv@mandriva.org> | 2009-10-01 14:44:39 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2009-10-01 14:44:39 +0000 |
commit | a8e0d6c1f4ce27a47a588034bb372413a2491acc (patch) | |
tree | 75864971baa00494ebd6ac62c37e8caedb97ba99 | |
parent | 7a5a4d4356942739a74b69253b08f31de3147a1f (diff) | |
download | rpmdrake-a8e0d6c1f4ce27a47a588034bb372413a2491acc.tar rpmdrake-a8e0d6c1f4ce27a47a588034bb372413a2491acc.tar.gz rpmdrake-a8e0d6c1f4ce27a47a588034bb372413a2491acc.tar.bz2 rpmdrake-a8e0d6c1f4ce27a47a588034bb372413a2491acc.tar.xz rpmdrake-a8e0d6c1f4ce27a47a588034bb372413a2491acc.zip |
(pkg2medium) pkg2medium() could return undef but several places
blindly dereferenced it which could lead to rare crashes (#49901)
-rwxr-xr-x | MandrivaUpdate | 2 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | Rpmdrake/formatting.pm | 2 | ||||
-rw-r--r-- | Rpmdrake/gui.pm | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/MandrivaUpdate b/MandrivaUpdate index 7c3d55e3..fba0ffad 100755 --- a/MandrivaUpdate +++ b/MandrivaUpdate @@ -90,7 +90,7 @@ sub refresh_packages_list { my ($name, $version, $release, $arch) = split_fullname($_); my $pkg = $pkgs->{$_}; my $raw_medium = pkg2medium($pkg->{pkg}, $urpm); - my $medium = $raw_medium ? $raw_medium->{name} : undef; + my $medium = !$raw_medium->{fake} ? $raw_medium->{name} : undef; my $icon; my $importance = $medium && $descriptions->{$medium}{$name}{importance}; if ($importance) { @@ -1,7 +1,8 @@ - gurpmi.addmedia o fix message when adding distrib media (#49566) - rpmdrake - o fix encoding of diff output (#52994) + o fix rare crash when medium is unknown (#49901) + o fix encoding of diff output (#52994) o fix for unreproductable crash (#49273) o update GUI package list diff --git a/Rpmdrake/formatting.pm b/Rpmdrake/formatting.pm index 8c2f7f0c..6e4e0dc7 100644 --- a/Rpmdrake/formatting.pm +++ b/Rpmdrake/formatting.pm @@ -100,7 +100,7 @@ sub pkg2medium { my ($p, $urpm) = @_; return if !ref $p; return { name => N("None (installed)") } if !defined($p->id); # if installed - URPM::pkg2media($urpm->{media}, $p) || undef; + URPM::pkg2media($urpm->{media}, $p) || { name => N("Unknown"), fake => 1 }; } # [ duplicate urpmi's urpm::msg::localtime2changelog() ] diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index 05240dd1..79639485 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -138,7 +138,7 @@ sub format_pkg_simplifiedinfo { my $upkg = $pkg->{pkg}; return if !$upkg; my $raw_medium = pkg2medium($upkg, $urpm); - my $medium = $raw_medium ? $raw_medium->{name} : undef; + my $medium = !$raw_medium->{fake} ? $raw_medium->{name} : undef; my $update_descr = $descriptions->{$medium}{$name}; # discard update fields if not matching: my $is_update = ($upkg->flag_upgrade && $update_descr && $update_descr->{pre}); |