chat: Fix loop condition to avoid possible 1-byte buffer overrun Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Fixing a few more memory leaks in chat.c Running Valgrind memcheck tool on chat.c while communicating with a modem found additional memory leaks. These fixes plumb those. Signed-off-by: Robert Bartel <r.bartel@gmx.net> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Fixing buffer overflow issue in chat.c There were two issues here, the report_buffer is too small to hold the value, and accessing the memory outside its bounds. The following fixes was made: - Expand the size of report_buffer to 4096 from 256, this is to account for handling of really long GSM USSD report strings - Make sure to not to access memory outside the bounds of the buffer Signed-off-by: Robert Bartel <r.bartel@gmx.net> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
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>
chat: Improve signal handling This improves the way that signals are handled in chat. First, signal handlers should not be calling functions which are not async-signal-safe; doing so incurs the possibility of deadlock. Thus we can't call fatal() in signal handlers; instead we set 'fatalsig', which functions both as a flag and as an indication of which signal occurred, and check that at various points (basically after any operation which might block) using the new function checksigs(). Secondly, using sigaction rather than signal() means that we can control whether calls such as read() get restarted after a signal, and whether the signal disposition gets reset when the signal is delivered. That simplifies sigalrm(); we no longer need to re-register the handler, and we don't need the kludge of setting stdin to non-blocking mode in order to get the read() in get_char() to return. This also removes a #ifdef ultrix since ultrix is no longer supported. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Fixing GCC -Wunused-result warning in chat.c resolving comments from Paul Mackerras Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
chat: Clean up usage of clean() function In a couple of places, we were calling clean(), which does environment variable substitution among other things, but then using the original string not the "cleaned" string when logging a message about what we're doing. Also, this removes a couple of checks that the "cleaned" string is not longer than the original string, which date back to the first version of the code checked into CVS. Those checks were appropriate before environment variable substitution was added in commit eaca954c2d4a ("add -E option to use environment variables, from Andreas Arens") and dynamic reallocation of the result buffer was added in commit 86dd2eec100d ("clean(): Fix buffer overflow.") but are no longer necessary. These changes were prompted by github issue #294 and redhat bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1650539 Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Convert to ANSI C This gets rid of the __P and __V macros that were used so that the code was in theory compilable by a K&R C compiler, and converts the function definitions to ANSI C style. In fact there were already quite a few function definitions in the ANSI C style, so it would not have been compilable by a K&R C compiler in fact. The Solaris and BSD kernel code modules have had __P removed but the function definitions have not been converted. There are some other minor changes here to remove warnings. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Various fixes for errors found by coverity static analysis (#109) Fixes #108 Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
chat: Allow TIMEOUT value to come from environment variable This allows the TIMEOUT value to be obtained from the environment using the $ENVVAR syntax. Signed-off-by: Paul Mackerras <paulus@samba.org>
Remove various warnings, fix pppol2tp install This fixes a collection of minor things that were resulting in harmless warnings (accidental trigraphs, missing prototypes, signed/unsigned char being used interchangeably) and corrects an error in the pppol2tp makefile, which meant that it wasn't installing anything. Signed-off-by: Paul Mackerras <paulus@samba.org>
Fixed compilation failure on Solaris due to new CHAP (missing chap-md5.o in makefile). Updated ppp_mod so that it will work with Solaris 10 and beyond (identify entry point is now obsolete). Fixed warnings in chat, bsd-comp, deflate, vjcompress, chap-new, sys-solaris, tty, pppdump, ppp_comp.
clean(): Fix buffer overflow.
style
Enlarged the report buffer to 256 bytes.
update from debian maintainer
add -E option to use environment variables, from Andreas Arens
Fix the rcsid's for non-ansi compilers
fix problem with REPORTing last line
get rid of warning