From 874fd64459579d83e6f13d823bee19f4aaa91a71 Mon Sep 17 00:00:00 2001 From: Tim Pepper Date: Mon, 27 Jun 2016 11:37:06 -0700 Subject: [PATCH] don't segfault on not found MoM If the MoM is not found on the server to match the os version on which you're running, swupd search's MoM downloader returns 0 instead of an error. EMOM_NOTFOUND is a natural value to return. When 0 is returned, the null MoM pointer is later derferenced leading to a segfault. Signed-off-by: Tim Pepper --- src/search.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search.c b/src/search.c index 4629646c..e5d7be9f 100644 --- a/src/search.c +++ b/src/search.c @@ -410,7 +410,7 @@ int download_manifests(struct manifest **MoM) *MoM = load_mom(current_version); if (!(*MoM)) { printf("Cannot load official manifest MoM for version %i\n", current_version); - return ret; + return EMOM_NOTFOUND; } subscription_versions_from_MoM(*MoM, 0);