From 12580a9aae94a20bbd5fb9facd19d364ef4e9c35 Mon Sep 17 00:00:00 2001 From: Judith Silverman Date: Fri, 27 Mar 2026 10:43:29 -0700 Subject: [PATCH] Fix NULL dereference in drmaa_wait() when wait_for_any_job() returns NULL --- drmaa_utils/drmaa_base.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drmaa_utils/drmaa_base.c b/drmaa_utils/drmaa_base.c index ee5e5f6..88154a4 100644 --- a/drmaa_utils/drmaa_base.c +++ b/drmaa_utils/drmaa_base.c @@ -517,7 +517,15 @@ drmaa_wait( session, job_id, drmaa_timeout_time(timeout, &ts), stat, (fsd_iter_t**)rusage ); - strlcpy( job_id_out, result_job_id, job_id_out_len ); + /* result_job_id might be NULL if wait_for_any_job() timed out */ + if( result_job_id != NULL ) + { + strlcpy( job_id_out, result_job_id, job_id_out_len ); + } + else if( job_id_out && job_id_out_len > 0 ) + { + job_id_out[0] = '\0'; + } } FINALLY {