--- freem/src/expr.c 2025/04/10 01:24:38 1.12 +++ freem/src/expr.c 2025/04/13 04:22:43 1.13 @@ -1,5 +1,5 @@ /* - * $Id: expr.c,v 1.12 2025/04/10 01:24:38 snw Exp $ + * $Id: expr.c,v 1.13 2025/04/13 04:22:43 snw Exp $ * expression parser * * @@ -24,6 +24,9 @@ * along with FreeM. If not, see . * * $Log: expr.c,v $ + * Revision 1.13 2025/04/13 04:22:43 snw + * Fix snprintf calls + * * Revision 1.12 2025/04/10 01:24:38 snw * Remove C++ style comments * @@ -4593,9 +4596,9 @@ extra_fun: if (obj_field) { - char t_objf[255]; + char t_objf[STRLEN]; - snprintf (t_objf, 254, "%s\201", object_instance); + snprintf (t_objf, STRLEN - 1, "%s\201", object_instance); dofram0 = dofrmptr; *dofrmptr++ = DELIM; @@ -5559,7 +5562,7 @@ errexfun: { char doggie_bag[50]; - snprintf (doggie_bag, 49, ".%ld\201", ilong); + snprintf (doggie_bag, sizeof (doggie_bag) - 1, ".%ld\201", ilong); stcat (a, doggie_bag); } } @@ -5568,7 +5571,7 @@ errexfun: case SVNsystem: - snprintf (a, 512, "%d,\"%s\"\201", MDC_VENDOR_ID, jour_hostid); + sprintf (a, "%d,\"%s\"\201", MDC_VENDOR_ID, jour_hostid); goto exec; @@ -5580,7 +5583,7 @@ errexfun: case SVNtlevel: - snprintf (a, 255, "%d\201", tp_level); + sprintf (a, "%d\201", tp_level); goto exec; @@ -5608,7 +5611,7 @@ errexfun: case SVNestack: { char esbuf[256]; - snprintf (esbuf, 255, "%d\201", estack); + sprintf (esbuf, "%d\201", estack); stcpy (a, esbuf); goto exec; @@ -5641,17 +5644,17 @@ errexfun: /* $DEVICE */ case 'd': if (devstat[io].mdc_err == 0) { - snprintf (a, 3, "0\201\0"); + sprintf (a, "0\201\0"); } else { - snprintf (a, 120, "%d,%d,%s\201\0", devstat[io].mdc_err, devstat[io].frm_err, devstat[io].err_txt); + sprintf (a, "%d,%d,%s\201\0", devstat[io].mdc_err, devstat[io].frm_err, devstat[io].err_txt); } goto exec; /* $STORAGE */ case 's': - snprintf (a, 255 , "%ld\201", DEFPSIZE); + sprintf (a, "%ld\201", DEFPSIZE); goto exec; /* $WITH */ @@ -5772,7 +5775,7 @@ errexfun: char zdf_key[50]; char fmt_string[128]; - snprintf (zdf_key, 49, "^$JOB\202%d\202ZDATE_FORMAT\201", pid); + snprintf (zdf_key, sizeof (zdf_key) - 1, "^$JOB\202%d\202ZDATE_FORMAT\201", pid); ssvn (get_sym, zdf_key, fmt_string); stcnv_c2m (fmt_string);