use snprintf; from maintainer David Krause

This commit is contained in:
pvalchev 2003-01-22 07:30:26 +00:00
parent b600438a9a
commit 3462d9aec0
3 changed files with 54 additions and 2 deletions

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-src_cmd_user_c,v 1.1 2003/01/22 07:30:26 pvalchev Exp $
--- src/cmd_user.c.orig Tue Jan 7 09:30:33 2003
+++ src/cmd_user.c Tue Jan 21 19:25:16 2003
@@ -2959,7 +2959,7 @@ static JUMP_F(CmdUserURL)
msg = "";
IMCliMsg (conn, cont, ExtraSet (NULL, EXTRA_MESSAGE, MSG_URL,
- s_sprintf ("%s%c%s", url, ConvSep (), msg)));
+ s_sprintf ("%s%c%s", msg, ConvSep (), url)));
free (url);
return 0;
@@ -3833,12 +3833,12 @@ static int CmdUserProcessAlias (const ch
ptr = strstr (exp, "%s");
*ptr = '\0';
- sprintf (cmdline, "%s%s%s", exp, argsd, ptr + 2);
+ snprintf (cmdline, sizeof(cmdline), "%s%s%s", exp, argsd, ptr + 2);
free (exp);
}
else
- sprintf (cmdline, "%s %s", alias->expansion, argsd);
+ snprintf (cmdline, sizeof(cmdline), "%s %s", alias->expansion, argsd);
recurs_level++;
CmdUserProcess (cmdline, idle_val, idle_flag);

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_contact_c,v 1.1 2003/01/22 07:30:26 pvalchev Exp $
--- src/contact.c.orig Tue Jan 7 10:12:05 2003
+++ src/contact.c Fri Jan 10 03:03:00 2003
@@ -885,9 +885,9 @@ void ContactSetVersion (Contact *cont)
if (cont->v1 || cont->v2 || cont->v3 || cont->v4)
{
strcat (buf, " ");
- sprintf (buf + strlen (buf), "%d.%d", cont->v1, cont->v2);
- if (cont->v3 || cont->v4) sprintf (buf + strlen (buf), ".%d", cont->v3);
- if (cont->v4) sprintf (buf + strlen (buf), ".%d", cont->v4);
+ snprintf (buf + strlen (buf), sizeof(buf) - strlen (buf), "%d.%d", cont->v1, cont->v2);
+ if (cont->v3 || cont->v4) snprintf (buf + strlen (buf), sizeof(buf) - strlen (buf), ".%d", cont->v3);
+ if (cont->v4) snprintf (buf + strlen (buf), sizeof(buf) - strlen (buf), ".%d", cont->v4);
}
if (tail) strcat (buf, tail);
}

View File

@ -1,6 +1,15 @@
$OpenBSD: patch-src_mreadline_c,v 1.5 2003/01/09 08:26:37 pvalchev Exp $
$OpenBSD: patch-src_mreadline_c,v 1.6 2003/01/22 07:30:26 pvalchev Exp $
--- src/mreadline.c.orig Tue Jan 7 13:17:51 2003
+++ src/mreadline.c Tue Jan 7 15:28:41 2003
+++ src/mreadline.c Fri Jan 10 02:42:40 2003
@@ -392,7 +392,7 @@ void R_process_input_tab (void)
if (bytelen < strlen (msgcmd) &&
!strncmp (s, msgcmd, bytelen < strlen (msgcmd) ? bytelen : strlen (msgcmd)))
{
- sprintf (s, "%s ", msgcmd);
+ snprintf (s, sizeof(s), "%s ", msgcmd);
bytepos = bytelen = strlen (s);
#ifdef ENABLE_UTF8
curpos = curlen = c_strlen (s);
@@ -414,9 +414,9 @@ void R_process_input_tab (void)
}