jcs
/subtext
/amendments
/354
session: Don't pass help directly to printf, use %s
jcs made amendment 354 about 1 year ago
--- session.c Thu Mar 2 09:05:05 2023
+++ session.c Sat Mar 4 22:29:03 2023
@@ -1260,7 +1260,7 @@ session_expand_var(struct session *session, char *ivar
bool *end_expansion)
{
static char var[128], retval[128];
- size_t retsize, retlen, varlen, mcount;
+ size_t retsize, retlen, varlen, unread_count;
struct tm *now;
short count;
bool pad = false;
@@ -1307,10 +1307,10 @@ session_expand_var(struct session *session, char *ivar
session->user->username : GUEST_USERNAME, retsize);
} else if (strcmp(var, "new_mail") == 0) {
if (session->user) {
- mcount = mail_find_ids_for_user(session->user, NULL,
- NULL, 0, 0, true);
- if (mcount)
- retlen = sprintf(retval, "(%ld New)", mcount);
+ mail_find_ids_for_user(session->user, &unread_count, NULL, 0,
+ 0, true);
+ if (unread_count)
+ retlen = sprintf(retval, "(%ld New)", unread_count);
}
} else if (var[0] == '"') {
/* a literal string, remove leading and trailing quotes */
@@ -1623,7 +1623,7 @@ get_menu_option:
goto get_menu_option;
session_printf(s, "%c\r\n", c);
- session_printf(s, invalid_option_help);
+ session_printf(s, "%s", invalid_option_help);
session_flush(s);
last_invalid = true;
}