Package: nbd-client
Version: 1:3.26.1-1
Severity: serious
Tags: patch
X-Debbugs-Cc: none, Hilko Bengen <ben...@debian.org>

Dear Maintainer,

While investigating libnbd build failures (see ##1066766), I stumbled
across a bug that makes nbd-server crash without an error message when
trying to read its configuration from /dev/null or any non-existing
file:

$ ./nbd-server -C /dev/null 
Segmentation fault

It turns out that one g_key_file_free() call was left in the code when
auto-freeing was introduced in upstream commit
ab41c4f5a91857d9466d83ea062ec60435f7eaa0. The attached patch fixes this.

Cheers,
-Hilko
Index: nbd-3.26.1/nbd-server.c
===================================================================
--- nbd-3.26.1.orig/nbd-server.c
+++ nbd-3.26.1/nbd-server.c
@@ -881,7 +881,6 @@ GArray* parse_cfile(gchar* f, struct gen
 			G_KEY_FILE_KEEP_TRANSLATIONS, &err)) {
 		g_set_error(e, NBDS_ERR, NBDS_ERR_CFILE_NOTFOUND, "Could not open config file %s: %s",
 				f, err->message);
-		g_key_file_free(cfile);
 		return retval;
 	}
 	startgroup = g_key_file_get_start_group(cfile);

Reply via email to