Fix a null pointer dereference when no DNS search path is configured.
This showed up as a segfault while running the gsasl test suite.
Taken from upstream:
https://github.com/krb5/krb5/commit/cd82bf377e7fad2409c76bf8b241920692f34fda
diff --git a/src/lib/krb5/os/dnsglue.c b/src/lib/krb5/os/dnsglue.c
index e35ca9d76c..0cd213fdd7 100644
--- a/src/lib/krb5/os/dnsglue.c
+++ b/src/lib/krb5/os/dnsglue.c
@@ -91,7 +91,7 @@ static int initparse(struct krb5int_dns_state *);
#define DECLARE_HANDLE(h) struct __res_state h
#define INIT_HANDLE(h) (memset(&h, 0, sizeof(h)), res_ninit(&h) == 0)
#define SEARCH(h, n, c, t, a, l) res_nsearch(&h, n, c, t, a, l)
-#define PRIMARY_DOMAIN(h) strdup(h.dnsrch[0])
+#define PRIMARY_DOMAIN(h) ((h.dnsrch[0] == NULL) ? NULL : strdup(h.dnsrch[0]))
#if HAVE_RES_NDESTROY
#define DESTROY_HANDLE(h) res_ndestroy(&h)
#else
@@ -104,7 +104,8 @@ static int initparse(struct krb5int_dns_state *);
#define DECLARE_HANDLE(h)
#define INIT_HANDLE(h) (res_init() == 0)
#define SEARCH(h, n, c, t, a, l) res_search(n, c, t, a, l)
-#define PRIMARY_DOMAIN(h) strdup(_res.defdname)
+#define PRIMARY_DOMAIN(h) \
+ ((_res.defdname == NULL) ? NULL : strdup(_res.defdname))
#define DESTROY_HANDLE(h)
#endif
f13c64b72a2dc5f0d30a259'>treecommitdiff
|
Age | Commit message (Expand) | Author |
2023-11-05 | tests: Honor system and target when lowering <system-test>....* gnu/tests.scm (compile-system-test): Wrap ‘system-test-value’ call in
‘mparameterize’.
Change-Id: I4be28913a86f43059b0886ad2fcf81a9c699b730
| Ludovic Courtès |
2023-04-21 | tests: Fork and exec a new Guile for the marionette REPL....By merely forking PID 1, details from PID 1 (shepherd) would leak into
the marionette process, such as the set of modules in scope and state
inherited from the shepherd process (<service> instances, fibers,
etc.). Running a fresh Guile instance avoids that.
* gnu/tests.scm (marionette-program): New procedure.
(marionette-shepherd-service): Change 'start' to use
'make-forkexec-constructor', and run the result of 'marionette-program'.
| Ludovic Courtès |