don't use the idiom
char foo[BUFSIZ];
snprintf(foo, BUFSIZ, ....);
but
char foo[BUFSIZ];
snprintf(foo, sizeo foo, ....);
because this will automatically catch situations where the size of foo
is later changed, e.g. like foo[BUFSIZ + 8];
Fix another use of sprintf.
XmString cancelLabel;
XmString okLabel;
- snprintf(prompt, BUFSIZ, (GETMESSAGE(1,5, "Enter password for user %s:")),
+ snprintf(prompt, sizeof prompt, (GETMESSAGE(1,5, "Enter password for user %s:")),
appArgs.user);
xmString = XmStringCreateLocalized(prompt);
xmString2 =XmStringCreateLocalized(GETMESSAGE(1,6, "Action Invoker - Password"));
/* remove the trailing '\n'... */
tstring[strlen(tstring) - 1] = '\0';
- (void) sprintf(buffer, "%s: %s %s\n",
+ (void) snprintf(buffer, sizeof buffer, "%s: %s %s\n",
(savedProgName && *savedProgName) ? savedProgName : "logger",
start ? "starting" : "terminating",
tstring);