From: shumikhinaka Date: Wed, 3 Jun 2026 21:31:45 +0000 (+0400) Subject: lib:printer_driver: Added pointer validation X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fsamba.git lib:printer_driver: Added pointer validation If no comma is found, strchr_m will return NULL. p will be set to NULL, and if (p) will not be executed. The variable p will remain set to NULL and will be passed to the spoolss_driver_version_to_qword function. If strchr_m returns NULL, the function immediately terminates and returns the status NT_STATUS_INVALID_PARAMETER. This prevents invalid data from being passed to subsequent functions. Pair-Programmed-With: Dmitry Mikhalchenko Signed-off-by: Shumikhina Ksenia Reviewed-by: Volker Lendecke Reviewed-by: Anoop C S Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Thu Jun 4 12:05:45 UTC 2026 on atb-devel-224 --- diff --git a/lib/printer_driver/printer_driver.c b/lib/printer_driver/printer_driver.c index 777ef2d2ee0..b6598e121aa 100644 --- a/lib/printer_driver/printer_driver.c +++ b/lib/printer_driver/printer_driver.c @@ -884,10 +884,11 @@ static NTSTATUS process_driver_driverver(struct gp_inifile_context *ctx, } p = discard_const_p(char, strchr_m(str, ',')); - if (p) { - *p = '\0'; - p++; + if (p == NULL) { + return NT_STATUS_INVALID_PARAMETER; } + *p = '\0'; + p++; ok = spoolss_timestr_to_NTTIME(str, &r->driver_date); if (!ok) {