[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-2-ga78b655
From: |
Mats Erik Andersson |
Subject: |
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-2-ga78b655 |
Date: |
Sat, 07 Jan 2012 12:23:26 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".
The branch, master has been updated
via a78b65595fefb959d0456529422deb42a2db2b8e (commit)
via 72dd08b85c0e4b9006df35899281e6dcba41a1e7 (commit)
from 1a11478c8f3471c7486fa45e7487b82b69b4c9d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=a78b65595fefb959d0456529422deb42a2db2b8e
commit a78b65595fefb959d0456529422deb42a2db2b8e
Author: Mats Erik Andersson <address@hidden>
Date: Sat Jan 7 13:17:44 2012 +0100
telnet: Filename buffer overrun when tracing.
diff --git a/ChangeLog b/ChangeLog
index f6fc634..cdbd4c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-07 Mats Erik Andersson <address@hidden>
+
+ * telnet/utilities.c (SetNetTrace): Filename buffer overrun: replace
+ strcpy() by strncpy().
+ (printoption, printsub): Code formatting of ternary operator.
+
2012-01-07 Guillem Jover <address@hidden>
* telnet/utilities.c (printsub) <env_common>: Use constant format
diff --git a/telnet/utilities.c b/telnet/utilities.c
index ddc7dc0..12a6b08 100644
--- a/telnet/utilities.c
+++ b/telnet/utilities.c
@@ -128,7 +128,8 @@ SetNetTrace (register char *file)
NetTrace = fopen (file, "w");
if (NetTrace)
{
- strcpy ((char *) NetTraceFile, file);
+ strncpy ((char *) NetTraceFile, file, sizeof (NetTraceFile));
+ NetTraceFile[sizeof (NetTraceFile) - 1] = 0;
return;
}
fprintf (stderr, "Cannot open %s.\n", file);
@@ -210,8 +211,10 @@ printoption (char *direction, int cmd, int option)
else
{
register char *fmt;
- fmt = (cmd == WILL) ? "WILL" : (cmd == WONT) ? "WONT" :
- (cmd == DO) ? "DO" : (cmd == DONT) ? "DONT" : 0;
+ fmt = (cmd == WILL)
+ ? "WILL" : (cmd == WONT)
+ ? "WONT" : (cmd == DO)
+ ? "DO" : (cmd == DONT) ? "DONT" : 0;
if (fmt)
{
fprintf (NetTrace, "%s %s ", direction, fmt);
@@ -395,8 +398,7 @@ printsub (char direction, unsigned char *pointer, int
length)
fprintf (NetTrace, "SEND");
break;
default:
- fprintf (NetTrace,
- "- unknown qualifier %d (0x%x).",
+ fprintf (NetTrace, "- unknown qualifier %d (0x%x).",
pointer[1], pointer[1]);
}
break;
@@ -493,8 +495,8 @@ printsub (char direction, unsigned char *pointer, int
length)
{
case TELQUAL_REPLY:
case TELQUAL_IS:
- fprintf (NetTrace, " %s ", (pointer[1] == TELQUAL_IS) ?
- "IS" : "REPLY");
+ fprintf (NetTrace, " %s ",
+ (pointer[1] == TELQUAL_IS) ? "IS" : "REPLY");
if (AUTHTYPE_NAME_OK (pointer[2]))
fprintf (NetTrace, "%s ", AUTHTYPE_NAME (pointer[2]));
else
@@ -505,10 +507,10 @@ printsub (char direction, unsigned char *pointer, int
length)
break;
}
fprintf (NetTrace, "%s|%s",
- ((pointer[3] & AUTH_WHO_MASK) == AUTH_WHO_CLIENT) ?
- "CLIENT" : "SERVER",
- ((pointer[3] & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) ?
- "MUTUAL" : "ONE-WAY");
+ ((pointer[3] & AUTH_WHO_MASK) == AUTH_WHO_CLIENT)
+ ? "CLIENT" : "SERVER",
+ ((pointer[3] & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL)
+ ? "MUTUAL" : "ONE-WAY");
auth_printsub (&pointer[1], length - 1, buf, sizeof (buf));
fprintf (NetTrace, "%s", buf);
@@ -529,10 +531,10 @@ printsub (char direction, unsigned char *pointer, int
length)
break;
}
fprintf (NetTrace, "%s|%s ",
- ((pointer[i] & AUTH_WHO_MASK) == AUTH_WHO_CLIENT) ?
- "CLIENT" : "SERVER",
- ((pointer[i] & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) ?
- "MUTUAL" : "ONE-WAY");
+ ((pointer[i] & AUTH_WHO_MASK) == AUTH_WHO_CLIENT)
+ ? "CLIENT" : "SERVER",
+ ((pointer[i] & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL)
+ ? "MUTUAL" : "ONE-WAY");
++i;
}
break;
@@ -581,8 +583,8 @@ printsub (char direction, unsigned char *pointer, int
length)
case ENCRYPT_IS:
case ENCRYPT_REPLY:
- fprintf (NetTrace, " %s ", (pointer[1] == ENCRYPT_IS) ?
- "IS" : "REPLY");
+ fprintf (NetTrace, " %s ",
+ (pointer[1] == ENCRYPT_IS) ? "IS" : "REPLY");
if (length < 3)
{
fprintf (NetTrace, " (partial suboption??\?)");
@@ -694,12 +696,12 @@ printsub (char direction, unsigned char *pointer, int
length)
break;
}
fprintf (NetTrace, "%s%s%s",
- pointer[i + SLC_FLAGS] & SLC_ACK ? "|ACK" : "",
- pointer[i +
- SLC_FLAGS] & SLC_FLUSHIN ? "|FLUSHIN" : "",
- pointer[i +
- SLC_FLAGS] & SLC_FLUSHOUT ? "|FLUSHOUT" :
- "");
+ (pointer[i + SLC_FLAGS] & SLC_ACK)
+ ? "|ACK" : "",
+ (pointer[i + SLC_FLAGS] & SLC_FLUSHIN)
+ ? "|FLUSHIN" : "",
+ (pointer[i + SLC_FLAGS] & SLC_FLUSHOUT)
+ ? "|FLUSHOUT" : "");
if (pointer[i + SLC_FLAGS] &
~(SLC_ACK | SLC_FLUSHIN | SLC_FLUSHOUT | SLC_LEVELBITS))
fprintf (NetTrace, "(0x%x)", pointer[i + SLC_FLAGS]);
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=72dd08b85c0e4b9006df35899281e6dcba41a1e7
commit 72dd08b85c0e4b9006df35899281e6dcba41a1e7
Author: Mats Erik Andersson <address@hidden>
Date: Sat Jan 7 13:15:02 2012 +0100
telnet: Non-constant format strings.
diff --git a/ChangeLog b/ChangeLog
index 5c2cb89..f6fc634 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-07 Guillem Jover <address@hidden>
+
+ * telnet/utilities.c (printsub) <env_common>: Use constant format
+ strings instead of offsets into fixed string. Remove NOQUOTE,
+ add QUOTE.
+
2012-01-06 Simon Josefsson <address@hidden>
inetutils 1.9.1
diff --git a/telnet/utilities.c b/telnet/utilities.c
index 60b4b3f..ddc7dc0 100644
--- a/telnet/utilities.c
+++ b/telnet/utilities.c
@@ -876,7 +876,7 @@ printsub (char direction, unsigned char *pointer, int
length)
fprintf (NetTrace, "INFO ");
env_common:
{
- register int noquote = 2;
+ const char *quote = "";
#if defined ENV_HACK && defined OLD_ENVIRON
extern int old_env_var, old_env_value;
#endif
@@ -891,15 +891,15 @@ printsub (char direction, unsigned char *pointer, int
length)
{
# ifdef ENV_HACK
if (old_env_var == OLD_ENV_VALUE)
- fprintf (NetTrace, "\" (VALUE) " + noquote);
+ fprintf (NetTrace, "%s(VALUE) ", quote);
else
# endif
- fprintf (NetTrace, "\" VAR " + noquote);
+ fprintf (NetTrace, "%sVAR ", quote);
}
else
#endif /* OLD_ENVIRON */
- fprintf (NetTrace, "\" VALUE " + noquote);
- noquote = 2;
+ fprintf (NetTrace, "%sVALUE ", quote);
+ quote = "";
break;
case NEW_ENV_VAR:
@@ -909,47 +909,46 @@ printsub (char direction, unsigned char *pointer, int
length)
{
# ifdef ENV_HACK
if (old_env_value == OLD_ENV_VAR)
- fprintf (NetTrace, "\" (VAR) " + noquote);
+ fprintf (NetTrace, "%s(VAR) ", quote);
else
# endif
- fprintf (NetTrace, "\" VALUE " + noquote);
+ fprintf (NetTrace, "%sVALUE ", quote);
}
else
#endif /* OLD_ENVIRON */
- fprintf (NetTrace, "\" VAR " + noquote);
- noquote = 2;
+ fprintf (NetTrace, "%sVAR ", quote);
+ quote = "";
break;
case ENV_ESC:
- fprintf (NetTrace, "\" ESC " + noquote);
- noquote = 2;
+ fprintf (NetTrace, "%sESC ", quote);
+ quote = "";
break;
case ENV_USERVAR:
- fprintf (NetTrace, "\" USERVAR " + noquote);
- noquote = 2;
+ fprintf (NetTrace, "%sUSERVAR ", quote);
+ quote = "";
break;
default:
if (isprint (pointer[i]) && pointer[i] != '"')
{
- if (noquote)
+ if (quote[0] == '\0')
{
putc ('"', NetTrace);
- noquote = 0;
+ quote = "\" ";
}
putc (pointer[i], NetTrace);
}
else
{
- fprintf (NetTrace, "\" %03o " + noquote,
- pointer[i]);
- noquote = 2;
+ fprintf (NetTrace, "%s%03o ", quote, pointer[i]);
+ quote = "";
}
break;
}
}
- if (!noquote)
+ if (quote[0] != '\0')
putc ('"', NetTrace);
break;
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 12 +++++++
telnet/utilities.c | 85 ++++++++++++++++++++++++++-------------------------
2 files changed, 55 insertions(+), 42 deletions(-)
hooks/post-receive
--
GNU Inetutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-2-ga78b655,
Mats Erik Andersson <=