Steve Youngs [Wed, 7 Mar 2012 22:24:54 +0000 (08:24 +1000)]
Coverity and build fixes from Nelson
* merges:
Coverity: CID 400010: Improper use of negative value
Coverity: CID 400001: Logically dead code
Coverity: CID 400005: Division or modulo by zero
Coverity: CID 400007: Deference after null check
Coverity: CID 400831: Out of bonds access
Coverity: CID 400832: Out of bounds access
Fix build
Fix the relocate_fd
Coverity CID 400833 UNINIT
Nelson Ferreira [Wed, 7 Mar 2012 15:21:00 +0000 (10:21 -0500)]
Coverity: CID 400010: Improper use of negative value
* src/ui/minibuf.c (echo_area_append): Make sure length<0 also
returns early here.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 14:58:51 +0000 (09:58 -0500)]
Merge branch 'for-steve' into njsf-cov
Nelson Ferreira [Wed, 7 Mar 2012 14:41:24 +0000 (09:41 -0500)]
Coverity: CID 400001: Logically dead code
* lib-src/etags.c (get_language_from_filename): Rework code a
little so that Coverity does not get fooled by ternary operator.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 14:37:39 +0000 (09:37 -0500)]
Coverity: CID 400005: Division or modulo by zero
* src/media/sound-oss.c (sound_oss_play): Fix gross condition
error of previous change
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 14:36:29 +0000 (09:36 -0500)]
Coverity: CID 400007: Deference after null check
* src/eval.c (Finteractive_p): Make sure btp is not NULL before
dereference.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 14:32:01 +0000 (09:32 -0500)]
Coverity: CID 400831: Out of bonds access
* src/fileio.c: Provide proper length to xstrncat
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 14:30:31 +0000 (09:30 -0500)]
Coverity: CID 400832: Out of bounds access
* src/editfns.c (Ftemp_directory): Proper size passed to xstrncat
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 14:13:54 +0000 (09:13 -0500)]
Fix build
* src/callproc.c (relocate_fd): fix the argument rename usage
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 13:29:21 +0000 (08:29 -0500)]
Merge branch 'master' into for-steve
Nelson Ferreira [Wed, 7 Mar 2012 13:25:49 +0000 (08:25 -0500)]
Fix the relocate_fd
* src/callproc.c (max_filedesc): New function to determine the
actual maximum file descriptor.
* src/callproc.c (relocate_fd): Realized previous use of just dup
was actually better, made sure that the closing of temporary duped
file descriptors was commented.
* src/emacs.c (__sys_stk_sz): Minor cosmetic variable rename.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 12:49:20 +0000 (07:49 -0500)]
Coverity CID 400833 UNINIT
* src/sysdep.c (raw_open): Use the proper argument for open
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Wed, 7 Mar 2012 03:03:07 +0000 (13:03 +1000)]
test suite fixes from Nelson
* merges:
Why are quick fixes so bad ? Because they break more than they fix
Nelson Ferreira [Wed, 7 Mar 2012 02:47:39 +0000 (21:47 -0500)]
Why are quick fixes so bad ? Because they break more than they fix
* src/emodules-ng.c (__emodng_open_prepend_paths): Fix xstpncpy
arguments. For real this time.
* src/emodules-ng.c (__emodng_open_prepend_paths_append_exts): Ditto.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Wed, 7 Mar 2012 02:45:29 +0000 (12:45 +1000)]
test suite fixes from Nelson
* merges:
Improve relocate_fd with dup2
Fix build
Nelson Ferreira [Wed, 7 Mar 2012 01:58:18 +0000 (20:58 -0500)]
Merge branch 'njsf-cov' into for-steve
Nelson Ferreira [Wed, 7 Mar 2012 01:53:56 +0000 (20:53 -0500)]
Improve relocate_fd with dup2
* src/callproc.c (relocate_fd): Satisfy checkers for return values
until proper check of getrlimit is implemented
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 7 Mar 2012 01:50:52 +0000 (20:50 -0500)]
Fix build
* src/emodules-ng.c (__emodng_open_prepend_paths): Correct usage of xstpcpy size argument.
* src/emodules-ng.c (_adapt_load_path): Ditto.
* src/emodules-ng.c (__emodng_open_prepend_paths_append_exts): Fix indentation
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Tue, 6 Mar 2012 22:20:11 +0000 (08:20 +1000)]
Fix autoload breakage from prev changeset from Nelson
* merges:
Fix introduced bug by coverity fix attempt
Nelson Ferreira [Tue, 6 Mar 2012 13:25:08 +0000 (08:25 -0500)]
Fix introduced bug by coverity fix attempt
* src/search.c (boyer_moore): User REGEXP_FASTMAP_MASK for the
bit-and instead of the REGEXP_FASTMAP_SIZE (which is clearly
wrong).
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Tue, 6 Mar 2012 07:39:44 +0000 (17:39 +1000)]
build fix from Nelson
* merges:
Make sure list-load-path-shadows can work after dmp
Steve Youngs [Tue, 6 Mar 2012 07:32:06 +0000 (17:32 +1000)]
Coverity and build chain fixes from Nelson
* merges:
Coverity: Resource leak: CID 400015
Fix configure.ac
Fix configure
xstrncpy saga
xstrncpy saga
xstrncpy saga
Fix tty build broken in last configure.ac changes
Do not add tty objects when no tty is available
Coverity: CID 400005: Division or modulo by zero
Coverity: CID 400006: Division or modulo by zero
Coverity: Out of bounds write: CID 21140
Coverity: CID 400012 Overrun dynamic
Fix build for branches without tags
Coverity CID 400013 Printf arg type mismatch
Coverity: CID 400031: Tainted string
Coverity: CID 400829: Uninit
Use dup2 if available for -t. Also check for ttyname and isatty in configure.
Coverity: CID 400828 Resource leak
Use AS_IF instead of if some places - be more M4sh friendly
Update copyright, remove unused ent arguments
Nelson Ferreira [Tue, 6 Mar 2012 07:18:10 +0000 (02:18 -0500)]
Make sure list-load-path-shadows can work after dmp
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 07:13:23 +0000 (02:13 -0500)]
Merge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxemacs into for-steve
Nelson Ferreira [Tue, 6 Mar 2012 07:10:19 +0000 (02:10 -0500)]
Coverity: Resource leak: CID 400015
* src/callproc.c (relocate_fd): Make sure that dup'ed file
descriptors < min are closed. In addition, make a better version
when dup2 is available.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 06:29:23 +0000 (01:29 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Tue, 6 Mar 2012 06:27:19 +0000 (01:27 -0500)]
Fix configure.ac
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 06:02:32 +0000 (01:02 -0500)]
Fix configure
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 05:58:48 +0000 (00:58 -0500)]
xstrncpy saga
* src/emodules-ng.c (__emodng_open_append_exts): Use xstrncpy instead of strncpy
* src/emodules-ng.c (__emodng_open_prepend_paths): Ditto.
* src/emodules-ng.c (__emodng_open_prepend_paths_append_exts): Ditto.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 05:52:11 +0000 (00:52 -0500)]
xstrncpy saga
* src/editfns.c (Ftemp_directory): Use xstrncpy instead of strncpy
and xstrncat instead of strcat
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 05:50:05 +0000 (00:50 -0500)]
xstrncpy saga
* src/database/postgresql.c (Fpq_connectdb): Use xstrncpy instead of strncpy
* src/database/postgresql.c (Fpq_connect_start): Ditto.
* src/database/postgresql.c (Fpq_exec): Ditto.
* src/database/postgresql.c (Fpq_get_result): Ditto.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 05:33:16 +0000 (00:33 -0500)]
Fix tty build broken in last configure.ac changes
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 03:08:38 +0000 (22:08 -0500)]
Merge branch 'for-steve' into njsf-tty
Nelson Ferreira [Tue, 6 Mar 2012 02:50:30 +0000 (21:50 -0500)]
Do not add tty objects when no tty is available
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 01:57:31 +0000 (20:57 -0500)]
Coverity: CID 400005: Division or modulo by zero
* src/media/sound-oss.c (sound_oss_play): Abort early when channels is 0.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Tue, 6 Mar 2012 00:53:42 +0000 (19:53 -0500)]
Coverity: CID 400006: Division or modulo by zero
* src/ui/window.c (Fwindow_displayed_text_pixel_height): Make sure
no division by 0 is attempted and use "best heuristic" of just
adding 3.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 23:04:10 +0000 (18:04 -0500)]
Coverity: Out of bounds write: CID 21140
* src/search.c (boyer_moore): Make it explicit that the value will
always be within the range of the index. Previously it was a side
effect of the downcast to unsigned char, now its explicit.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 22:45:25 +0000 (17:45 -0500)]
Coverity: CID 400012 Overrun dynamic
* lib-src/gnuclient.c (clean_string): Avoid coverity aliasing
shortcomings by reusing the same variable where the length is
calculate for the copy pass.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 22:43:17 +0000 (17:43 -0500)]
Fix build for branches without tags
* autogen.sh (emacs_is_beta): Correct the text for branches
without the release tags...
* lib-src/make-dump-id.c: Include the config.h from the proper
directory. This was not an issue for a long time, since there was
always a tag when under git control. make-dump-id was only
compiled then. Now in autogen.sh we will always make sure there is
a tree version, so this will no longer be an issue again.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 19:38:46 +0000 (14:38 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Mon, 5 Mar 2012 19:35:38 +0000 (14:35 -0500)]
Merge remote-tracking branch 'origin/master' into for-steve
Nelson Ferreira [Mon, 5 Mar 2012 19:34:32 +0000 (14:34 -0500)]
Merge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxemacs into for-steve
Nelson Ferreira [Mon, 5 Mar 2012 19:33:35 +0000 (14:33 -0500)]
Merge branch 'master' into njsf-cov
Nelson Ferreira [Mon, 5 Mar 2012 19:33:11 +0000 (14:33 -0500)]
Coverity CID 400013 Printf arg type mismatch
* lib-src/make-path.c: Include string.h so that strerror is
properly defined.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 18:11:52 +0000 (13:11 -0500)]
Coverity: CID 400031: Tainted string
* lib-src/yow.c (main): Make sure argv[2] is not NULL before copying
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 18:09:31 +0000 (13:09 -0500)]
Coverity: CID 400829: Uninit
* src/media/media.c (Fmedia_stream_aspect): Initialize the
potential return value to nil
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 17:52:55 +0000 (12:52 -0500)]
Use dup2 if available for -t. Also check for ttyname and isatty in configure.
* configure.ac: Add some additional functions to check and add the
HAVE_ISATTY and HAVE_TTYNAME
* src/emacs.c (main_1): Enhance the logging of -t with ttyname if
it is available.
* src/emacs.c (main_1): Use raw_open instead of open to avoid
using the format conversion of the filename, which at this early
stage is not setup yet.
* src/emacs.c (main_1): use dup2 if available to dup the opened
file (and then close the original descriptor). This is much more
reliable than close then open, since dup2 will make sure the
descriptor number will be the desired.
* src/eval.c (grow_specpdl): If grow_specpdl is called very early
on specpdl_size is 0 and will loop infinitely here because 2 * 0
== 0 ;)
* src/sysdep.c (raw_open): New function that just calls the system
open with no argument conversion at all
* src/sysfile.h: declare the new raw_open function.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 5 Mar 2012 01:19:52 +0000 (20:19 -0500)]
Coverity: CID 400828 Resource leak
* src/emacs.c (main_1): Make sure second dup is fdesc 1
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Sun, 4 Mar 2012 23:22:38 +0000 (09:22 +1000)]
xstrncpy updates from Nelson
* merges:
xstrncpy saga
xstrncpy saga
xstrncpy saga
xstrncpy saga
Nelson Ferreira [Sun, 4 Mar 2012 22:12:24 +0000 (17:12 -0500)]
xstrncpy saga
* src/effi.c (Fffi_load_library): use xstrncpy instead of strncpy, strncat
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sun, 4 Mar 2012 21:57:18 +0000 (16:57 -0500)]
xstrncpy saga
* src/dumper.c (pdump_load): Use xstrncpy instead of strcpy
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sun, 4 Mar 2012 21:55:45 +0000 (16:55 -0500)]
xstrncpy saga
* src/sysdep.c (init_system_name): use xstrncpy instead of strcpy
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sun, 4 Mar 2012 21:51:53 +0000 (16:51 -0500)]
xstrncpy saga
* src/sysdep.c (init_system_name): Use xstrncpy instead of strncpy
* src/sysdep.c (readdir): Ditto.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sun, 4 Mar 2012 05:00:09 +0000 (00:00 -0500)]
Use AS_IF instead of if some places - be more M4sh friendly
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sun, 4 Mar 2012 04:57:17 +0000 (23:57 -0500)]
Update copyright, remove unused ent arguments
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Sun, 4 Mar 2012 01:48:48 +0000 (11:48 +1000)]
Various build updates from Nelson
* merges:
Add the new silent-rules options to the list of known configure opts
Warn about ignored tty 'with' options. Fix if with missing fi
Add additional tty lib 'with' options
issue warning when no tty nor window system available
Enable silent building, ie --enable-silent-rules and make V=0
Correct the remote configuration command message
new SXE_CHECK_LINK_LIB macro
Add summary for additional tty libraries
Rename git-to-steve -> git-for-steve
xstrncpy saga
Better checking of string and memory operations. Also, add define FORBID_STRCPY to make runtime asserts on usage of strcpy, strcat and stpcpy.
xstrncpy saga
xstrncpy saga
xstrncpy saga
xstrncpy saga
Steve Youngs [Sun, 4 Mar 2012 01:48:00 +0000 (11:48 +1000)]
Add the new silent-rules options to the list of known configure opts
* m4/sxe-aux.m4 (_SXE_CHECK_PURE_OPT): Add silent-rules options to
list of known configure opts.
Signed-off-by: Steve Youngs <steve@sxemacs.org>
Steve Youngs [Sun, 4 Mar 2012 01:00:55 +0000 (11:00 +1000)]
FFI update from Aidan
* merges:
Avoid namespace pollution, runtime consing, #'define-ffi-function
Aidan Kehoe [Sat, 3 Mar 2012 15:19:35 +0000 (15:19 +0000)]
Avoid namespace pollution, runtime consing, #'define-ffi-function
Nelson Ferreira [Sat, 3 Mar 2012 05:33:54 +0000 (00:33 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Sat, 3 Mar 2012 05:33:34 +0000 (00:33 -0500)]
Merge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxemacs into for-steve
Nelson Ferreira [Sat, 3 Mar 2012 05:30:44 +0000 (00:30 -0500)]
Warn about ignored tty 'with' options. Fix if with missing fi
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 05:17:10 +0000 (00:17 -0500)]
Add additional tty lib 'with' options
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 05:14:44 +0000 (00:14 -0500)]
issue warning when no tty nor window system available
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 05:11:28 +0000 (00:11 -0500)]
Enable silent building, ie --enable-silent-rules and make V=0
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 05:00:23 +0000 (00:00 -0500)]
Correct the remote configuration command message
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 04:53:55 +0000 (23:53 -0500)]
new SXE_CHECK_LINK_LIB macro
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 04:51:42 +0000 (23:51 -0500)]
Add summary for additional tty libraries
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 04:49:39 +0000 (23:49 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Sat, 3 Mar 2012 04:48:03 +0000 (23:48 -0500)]
Rename git-to-steve -> git-for-steve
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 04:15:07 +0000 (23:15 -0500)]
xstrncpy saga
* src/fileio.c (file_name_as_directory): Use xstrncpy and change
prototype to take in buffer length.
* src/fileio.c (directory_file_name): Ditto.
* src/fileio.c (Ffile_name_as_directory): properly call
file_name_as_directory with buffer length.
* src/fileio.c (Fdirectory_file_name): ditto.
* src/fileio.c (Fexpand_file_name): Use xstrncat instead of strcat.
* src/fileio.c (Fdirectory_file_name): properly call
directory_file_name with buffer length.
* src/fileio.c (Fsubstitute_in_file_name): use xstrncpy instead of
strcpy keeping track of buffer availability.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Sat, 3 Mar 2012 04:07:47 +0000 (23:07 -0500)]
Better checking of string and memory operations.
Also, add define FORBID_STRCPY to make runtime asserts on usage of strcpy, strcat and stpcpy.
* src/sysdep.h: Move xstrlen, xstrcmp, xstrcat, xstrncmp,
xstrncat, xstrncpy, xstpcpy, xstpncpy, xmemcmp, xmemcpy to
sxe-utils.h
* src/sysdep.h (x__dirlen): always_inline..
* src/sysdep.h (x__dirname): ditto.
* src/sysdep.h (xdirname): ditto.
* src/sxe-utils.h (xstrlen): move from sysdep.h
* src/sxe-utils.h (xstrcmp): ditto.
* src/sxe-utils.h (xstrncmp): ditto.
* src/sxe-utils.h (xstrncat): ditto.
* src/sxe-utils.h (xstrncpy): ditto.
* src/sxe-utils.h (xstpcpy): ditto.
* src/sxe-utils.h (xstpncpy): ditto.
* src/sxe-utils.h (xmemcmp): ditto.
* src/sxe-utils.h (xmemcpy): ditto.
* src/sxe-utils.h (xmin_size_t): ditto.
* src/sxe-utils.h (no_strcpy): New forbidden strcpy
* src/sxe-utils.h (no_strcat): New forbidden strcat
* src/sxe-utils.h (no_stpcpy): New forbidden stpcpy
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 2 Mar 2012 22:56:47 +0000 (17:56 -0500)]
xstrncpy saga
* src/dumper.c (pdump_load): Use xstrncpy instead of strncpy
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 2 Mar 2012 22:29:57 +0000 (17:29 -0500)]
xstrncpy saga
* src/sysdep.h (xstrncpy): New inline function.
* src/sysdep.h (xstpncpy): Use xstrncpy instead of strncpy
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 2 Mar 2012 21:20:19 +0000 (16:20 -0500)]
xstrncpy saga
* lib-src/fakemail.c (make_file_preface): Use xstrncpy instead of strncpy
* lib-src/fakemail.c (read_header): ditto.
* lib-src/fakemail.c (main): ditto.
* lib-src/gnuclient.c (main): ditto.
* lib-src/gnuserv.c (handle_ipc_request): ditto.
* lib-src/movemail.c (concat): ditto.
* lib-src/movemail.c (pop_retr): ditto.
* lib-src/movemail.c (pop_retr): ditto.
* lib-src/movemail.c (pop_search_top): ditto.
* lib-src/movemail.c (pop_search_top): ditto.
* lib-src/ootags.c (consider_token): ditto.
* lib-src/ootags.c (C_entries): ditto.
* lib-src/ootags.c (Pascal_functions): ditto.
* lib-src/ootags.c (Prolog_functions): ditto.
* lib-src/ootags.c (Erlang_functions): ditto.
* lib-src/ootags.c (substitute): ditto.
* lib-src/ootags.c (savenstr): ditto.
* lib-src/pop.c (pop_stat): ditto.
* lib-src/pop.c (pop_list): ditto.
* lib-src/pop.c (pop_multi_first): ditto.
* lib-src/pop.c (pop_last): ditto.
* lib-src/pop.c (getok): ditto.
* lib-src/yow.c (main): ditto.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 2 Mar 2012 21:12:41 +0000 (16:12 -0500)]
xstrncpy saga
* lib-src/etags.c (xstrncpy): cosmetic changes to xstrncpy macro
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Thu, 1 Mar 2012 23:19:07 +0000 (09:19 +1000)]
Coverity fixes from Nelson
* merges:
Kill some spurious whitespace
Coverity: Resource leak: CID 400020
Coverity: Resource leak: CID 400022
Coverity: Resource leak: CID 400023
Coverity: Resource leak: 400024
Coverity: Stray pointer arithmetic: CID 400000
Coverity: Division by zero: CID 400004
Coverity: Resource leak: CID 400025
Coverity: Resource Leak: CID 400026
Don't use strncpy, instead use *dest='\0' followed by strncat (with len-1)
Coverity: CID 21065: Missing break
Coverity: DEADCODE: CID 583
Steve Youngs [Thu, 1 Mar 2012 23:18:20 +0000 (09:18 +1000)]
Kill some spurious whitespace
Signed-off-by: Steve Youngs <steve@sxemacs.org>
Nelson Ferreira [Wed, 29 Feb 2012 21:11:08 +0000 (16:11 -0500)]
Coverity: Resource leak: CID 400020
* src/editfns.c (Ftemp_directory): Check against 0 too. Unlikely
but possible.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 21:07:06 +0000 (16:07 -0500)]
Coverity: Resource leak: CID 400022
* src/emacs.c (main_1): Make sure the temporary descriptor is 0,
which makes the "leak" intentional.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 20:19:03 +0000 (15:19 -0500)]
Coverity: Resource leak: CID 400023
* src/fileio.c (Fcopy_file): make sure ifd is closed
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 20:15:00 +0000 (15:15 -0500)]
Coverity: Resource leak: 400024
* src/fileio.c (Fdo_auto_save): Make sure file is closed
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 19:57:22 +0000 (14:57 -0500)]
Coverity: Stray pointer arithmetic: CID 400000
* src/callint.c (Fcall_interactively): add new fcall array, which
is the one allocated, and make args value derive from that. Fill
in function in fcall, and arguments in args.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 19:53:52 +0000 (14:53 -0500)]
Coverity: Division by zero: CID 400004
* src/media/media.c (Fmedia_stream_aspect): assert for den != 0,
with additional check for the "already crashing" scenario.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 19:52:07 +0000 (14:52 -0500)]
Coverity: Resource leak: CID 400025
* src/ui/X11/glyphs-x.c (x_init_image_instance_from_eimage): Free
pixtbl if we are not using it...
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 19:49:01 +0000 (14:49 -0500)]
Coverity: Resource Leak: CID 400026
* src/ui/redisplay.c (add_glyph_rune): Dynarr_free not used
allocated memory.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 18:29:13 +0000 (13:29 -0500)]
Don't use strncpy, instead use *dest='\0' followed by strncat (with len-1)
* lib-src/etags.c (write_classname): use xstrncpy instead of strncpy
* lib-src/etags.c (consider_token): ditto.
* lib-src/etags.c (C_entries): ditto.
* lib-src/etags.c (Pascal_functions): ditto.
* lib-src/etags.c (HTML_lables): ditto.
* lib-src/etags.c (Prolog_functions): ditto.
* lib-src/etags.c (Erlang_functions): ditto.
* lib-src/etags.c (substitute): ditto.
* lib-src/etags.c (readline_internal): ditto.
* lib-src/etags.c (savenstr): ditto.
* lib-src/etags.c (concat): ditto.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Wed, 29 Feb 2012 15:56:01 +0000 (10:56 -0500)]
Coverity: CID 21065: Missing break
* src/regex.c (common_op_match_null_string_p): Insert missing
brake for set_number_at case.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Mon, 27 Feb 2012 04:32:30 +0000 (23:32 -0500)]
Coverity: DEADCODE: CID 583
* src/media/media-internal.c (int2ulaw): Do the assignment outside
of if condition to avoid Coverity false positive and improve code
legibility.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Sat, 25 Feb 2012 06:19:43 +0000 (16:19 +1000)]
Coverity fixes from Nelson
* merges:
Coverity: Overrun static CID: 138
Coverity: CID 681: TAINTED STRING
Coverity: CID 610-DEAD CODE 611-UNUSED VALUE
Coverity: TOCTOU: CID 387
Coverity:Tainted string: CID 384
Coverity: Tainted string: CID 386
Nelson Ferreira [Fri, 24 Feb 2012 21:28:20 +0000 (16:28 -0500)]
Coverity: Overrun static CID: 138
* src/dumper.c (pdump_register_struct): Be even more obvious that
control flow ends on abort, which could fall through in the case
of fatal error.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 24 Feb 2012 21:26:52 +0000 (16:26 -0500)]
Coverity: CID 681: TAINTED STRING
* src/emacs.c (main): Be even more strict on checks...
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 24 Feb 2012 21:10:44 +0000 (16:10 -0500)]
Coverity: CID 610-DEAD CODE 611-UNUSED VALUE
* lib-src/etags.c (process_file_name): compr was not being used
before anyway so just remove the assignment from the if statement.
* lib-src/etags.c (process_file_name): only make compressed_value
NULL if it was previously not null. But still free it. This means
that after the free we CANNOT dereference it.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 24 Feb 2012 17:51:35 +0000 (12:51 -0500)]
Coverity: TOCTOU: CID 387
* lib-src/etags.c (process_file_name): use open/popen then handle
failure, instead of stat. Also, after successful open check it is
regular file, and reject it is not.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 24 Feb 2012 17:47:30 +0000 (12:47 -0500)]
Coverity:Tainted string: CID 384
* lib-src/movemail.c (main): Sanitize argv[optind] so one can mark as fixed
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Nelson Ferreira [Fri, 24 Feb 2012 15:36:55 +0000 (10:36 -0500)]
Coverity: Tainted string: CID 386
* src/emacs.c (main): Do sanity checking on the arguments
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Steve Youngs [Thu, 23 Feb 2012 06:58:37 +0000 (16:58 +1000)]
Really fix FreeBSD -fstack-protector builds
* freebsd-ssp:
Fix building on FreeBSD with -fstack-protector.
Steve Youngs [Thu, 23 Feb 2012 06:57:06 +0000 (16:57 +1000)]
Fix building on FreeBSD with -fstack-protector.
So, as it turns out, FreeBSD CAN build SXEmacs with -fstack-protector.
But only if you DON'T link with libssp. Who knew?
* m4/sxe-compiler.m4 (SXE_STACK_FLAGS): Re-work so that on FreeBSD
libssp is NOT used, while it is everywhere else.
Signed-off-by: Steve Youngs <steve@sxemacs.org>
Steve Youngs [Thu, 23 Feb 2012 00:06:52 +0000 (10:06 +1000)]
Coverity fixes, etc from Nelson
* merges:
Coverity: TOCTOU: CID 392
Fix build...
Coverity: TOCTOU: CID 391
Coverity: TOCTOU: CID 390
Coverity: TOCTOU: CID 387
Better stack-protector behavior in FreeBSD
Remove forceful disable of ase in Mac OS X
Coverity CID 52: Forward null
Slightly better basic type detection.
Nelson Ferreira [Wed, 22 Feb 2012 23:38:13 +0000 (18:38 -0500)]
Coverity: TOCTOU: CID 392
* src/editfns.c (Ftemp_directory): First mkdir then properly
handle errors for the home directory temp directory creation.
Also attempt to create .created_by_sxemacs in case the dir exists.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>