telnet/netkit-telnet-0.17-gcc7.patch

122 lines
3.3 KiB
Diff

diff --git a/telnet/utilities.c b/telnet/utilities.c
index 0bb0eab..d89ca37 100644
--- a/telnet/utilities.c
+++ b/telnet/utilities.c
@@ -748,6 +748,7 @@ printsub(char direction, unsigned char *pointer, int length)
env_common:
{
register int noquote = 2;
+ char* msg;
#if defined(ENV_HACK) && defined(OLD_ENVIRON)
extern int old_env_var, old_env_value;
#endif
@@ -758,14 +759,24 @@ printsub(char direction, unsigned char *pointer, int length)
/* case NEW_ENV_OVAR: */
if (pointer[0] == TELOPT_OLD_ENVIRON) {
# ifdef ENV_HACK
- if (old_env_var == OLD_ENV_VALUE)
- fprintf(NetTrace, "\" (VALUE) " + noquote);
- else
+ if (old_env_var == OLD_ENV_VALUE) {
+ msg = "\" (VALUE) ";
+ fprintf(NetTrace, "%s", msg + noquote);
+ }
+ else {
# endif
- fprintf(NetTrace, "\" VAR " + noquote);
+ msg = "\" VAR ";
+ fprintf(NetTrace, "%s", msg + noquote);
+# ifdef ENV_HACK
+ }
+#endif /*ENV_HACK*/
} else
#endif /* OLD_ENVIRON */
- fprintf(NetTrace, "\" VALUE " + noquote);
+ msg = "\" VALUE ";
+ fprintf(NetTrace, "%s", msg + noquote);
+#ifdef OLD_ENVIRON
+ }
+#endif /* OLD_ENVIRON */
noquote = 2;
break;
@@ -774,24 +785,36 @@ printsub(char direction, unsigned char *pointer, int length)
/* case OLD_ENV_VALUE: */
if (pointer[0] == TELOPT_OLD_ENVIRON) {
# ifdef ENV_HACK
- if (old_env_value == OLD_ENV_VAR)
- fprintf(NetTrace, "\" (VAR) " + noquote);
- else
+ if (old_env_value == OLD_ENV_VAR) {
+ msg = "\" (VAR) ";
+ fprintf(NetTrace, "%s", msg + noquote);
+ }
+ else {
# endif
- fprintf(NetTrace, "\" VALUE " + noquote);
- } else
+ msg = "\" VALUE ";
+ fprintf(NetTrace, "%s", msg + noquote);
+# ifdef ENV_HACK
+ }
+# endif
+ } else {
#endif /* OLD_ENVIRON */
- fprintf(NetTrace, "\" VAR " + noquote);
+ msg = "\" VAR ";
+ fprintf(NetTrace, "%s", msg + noquote);
+#ifdef OLD_ENVIRON
+ }
+#endif
noquote = 2;
break;
case ENV_ESC:
- fprintf(NetTrace, "\" ESC " + noquote);
+ msg = "\" ESC ";
+ fprintf(NetTrace, "%s", msg + noquote);
noquote = 2;
break;
case ENV_USERVAR:
- fprintf(NetTrace, "\" USERVAR " + noquote);
+ msg = "\" USERVAR ";
+ fprintf(NetTrace, "%s", msg + noquote);
noquote = 2;
break;
diff --git a/telnetd/utility.c b/telnetd/utility.c
index 4a438be..82edee5 100644
--- a/telnetd/utility.c
+++ b/telnetd/utility.c
@@ -969,22 +969,26 @@ printsub(char direction, unsigned char *pointer, int length)
env_common:
{
register int noquote = 2;
+ char* msg;
for (i = 2; i < length; i++ ) {
switch (pointer[i]) {
case ENV_VAR:
if (pointer[1] == TELQUAL_SEND)
goto def_case;
- netoprintf("\" VAR " + noquote);
+ msg = "\" VAR ";
+ netoprintf("%s", msg + noquote);
noquote = 2;
break;
case ENV_VALUE:
- netoprintf("\" VALUE " + noquote);
+ msg = "\" VALUE ";
+ netoprintf("%s", msg + noquote);
noquote = 2;
break;
case ENV_ESC:
- netoprintf("\" ESC " + noquote);
+ msg = "\" ESC ";
+ netoprintf("%s", msg + noquote);
noquote = 2;
break;