diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index fe67f757533..7c440938ca8 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -3089,7 +3089,8 @@ const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_ */ int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault) { - int maxjobs = (service != NULL) ? service->max_print_jobs : sDefault->max_print_jobs; + int maxjobs = lpcfg_max_print_jobs(service, sDefault); + if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID) maxjobs = PRINT_MAX_JOBID - 1; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 7c1abdea174..28dba050494 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4143,7 +4143,8 @@ void lp_set_logfile(const char *name) int lp_maxprintjobs(int snum) { - int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->max_print_jobs : sDefault.max_print_jobs; + int maxjobs = lp_max_print_jobs(snum); + if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID) maxjobs = PRINT_MAX_JOBID - 1;