summaryrefslogtreecommitdiff
path: root/chat
diff options
context:
space:
mode:
authorEivind Næss <eivnaes@yahoo.com>2023-03-16 16:13:25 -0700
committerGitHub <noreply@github.com>2023-03-17 10:13:25 +1100
commita20059a09c56555f6c2006a7193de4c1676b477a (patch)
tree59dbb2eae2f1b52abdf63db82390cb2a6a4678be /chat
parent5c9f2d0e37f7b761e7d966385028f32cb0cca0cf (diff)
downloadppp-a20059a09c56555f6c2006a7193de4c1676b477a.tar.gz
Fix several issues uncovered by Coverity (#397)
* Fix for coverity issue 436265, we should cap copy to size of destination buffer Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fix for coverity issue 436262, llv6_ntoa() returns a pointer to a buffer that can be up to 64 bytes long; likely not a problem, but this will quiet coverity Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fix for coverity issue 436251, not freeing path in the normal flow of the code Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436258, Digest maybe uninitialized in some paths of this code Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fix for coverity issue 436254, forgot to free 's' before returning from the function? Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436251, memory leak in put_string() function Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue 436215, should copy at most sizeof(devname) bytes Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436203, if no authentication (or no accounting) server was found, we still need to free the allocated local instance Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436171, use of uninitialized variable Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Use of signed vs unsigned variable in printf for MD4Update Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436182, fixing possible buffer overrun in handling of PW_CLASS attribute Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436156 Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Compile errors Signed-off-by: Eivind Næss <eivnaes@yahoo.com> [paulus@ozlabs.org - Squashed to avoid breaking bisection] Signed-off-by: Eivind Næss <eivnaes@yahoo.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'chat')
-rw-r--r--chat/chat.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/chat/chat.c b/chat/chat.c
index f625a8a..0740229 100644
--- a/chat/chat.c
+++ b/chat/chat.c
@@ -1133,7 +1133,7 @@ int chat_send (register char *s)
if (verbose)
msgf("timeout set to %d seconds", timeout);
-
+ free(s);
return 0;
}
@@ -1247,8 +1247,11 @@ int write_char(int c)
int put_string(register char *s)
{
+ char *s1;
quiet = 0;
+
s = clean(s, 1);
+ s1 = s;
if (verbose) {
if (quiet)
@@ -1263,8 +1266,10 @@ int put_string(register char *s)
register char c = *s++;
if (c != '\\') {
- if (!write_char (c))
+ if (!write_char (c)) {
+ free(s1);
return 0;
+ }
continue;
}
@@ -1283,8 +1288,10 @@ int put_string(register char *s)
break;
default:
- if (!write_char (c))
+ if (!write_char (c)) {
+ free(s1);
return 0;
+ }
break;
}
checksigs();
@@ -1292,6 +1299,7 @@ int put_string(register char *s)
alarm(0);
alarmed = 0;
+ free(s1);
return (1);
}