Commit Graph

35 Commits

Author SHA1 Message Date
Patrick Winnertz
c83e1995e4 Merge branch '241_buffer_overflow' into mc-4.6
* 241_buffer_overflow:
  Resolve some issues in mhl Rollang Illig pointed us to:
  Added enhancements from Sergei which he attached to #241.
  Call va_end after the iteration as we need to free the list again.
  Fixing a theoretical buffer overflow which was reported by Roland Illig

Conflicts:
	mhl/types.h

Signed-off-by: Patrick Winnertz <winnie@debian.org>
2009-02-04 12:42:58 +01:00
Patrick Winnertz
60f2d8d3c0 Resolve some issues in mhl Rollang Illig pointed us to:
- isspace & toupper needs an unsigned char as arg
  - collision with compiler namespace __X
  - resolved some typos

Signed-off-by: Patrick Winnertz <winnie@debian.org>
2009-02-04 12:02:13 +01:00
Patrick Winnertz
34fe2312b4 Added enhancements from Sergei which he attached to #241.
This will remove the static coded max arguments to concat.

Signed-off-by: Patrick Winnertz <winnie@debian.org>
2009-02-04 11:51:30 +01:00
Enrico Weigelt, metux IT service
1d8ef0b089 fixed #240 2009-02-04 01:08:29 +01:00
Patrick Winnertz
51388bd012 Call va_end after the iteration as we need to free the list again.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
2009-02-03 20:09:40 +01:00
Patrick Winnertz
f148fc29d2 Fixing a theoretical buffer overflow which was reported by Roland Illig
if the concat function was called with more than 32 parameters there will be
 a buffer overflow. This will add a small check to ensure that we concat only 32 parameters.

Signed-off-by: Patrick Winnertz <winnie@debian.org>
2009-02-03 19:45:39 +01:00
Sergei Trofimovich
80a6897271 cleanup: mhl_str_dir_plus_file(): int -> size_t (suggested by Andrew Borodin)
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-02-01 22:01:49 +02:00
Sergei Trofimovich
7a51b50d5c mhl: mhl_shell_unescape_buf(): fixed memory array OOB.
Function misbehaves whe input string ends with backslash.

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-02-01 14:01:12 +02:00
Sergei Trofimovich
ff4de3d66f Merge branch 'mc-4.6' into 147_escaping
* mc-4.6:
  replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file()
  fixed out-of-tree-builds
  Updated the NEWS file for 4.6.2 and added the bugnumbers behind the items in the list.
  Update for OpenOffice and StarOffice viewer.
  changelog: added entry for python syntax
  syntax: python: keywords update (patch by NNemec) fixes #216
  AC_USE_SYSTEM_EXTENSIONS macro requires autoconf >= 2.60
  po/ru.po: In russian translation, there are some hotkey conficts in menu.
  ChangeLog/NEWS: added entry for #181 ticket (copy to deleted dir)
  Now a trailing slash will only be added in copy & move dialogs if the path itselfs
  copy/move dialog: add trailing '/' to default destination path (fix #181)
  fixed comments to /* ... */
  Not only comment it out but removing it
  Removed unneeded var to make build process a bit cleaner
  Add code snipplet by il.smind which should fix issues with putty and

Conflicts:
	ChangeLog
	mhl/string.h
	src/command.c
	src/complete.c
	src/file.c
	src/util.c
2009-01-31 22:18:19 +02:00
Enrico Weigelt, metux IT service
54d6ec88dc replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file() 2009-01-31 16:51:58 +01:00
Sergei Trofimovich
e48cb7c89f mhl: added mhl_strmove() function (memmove semantics)
valgrind detected an error in completion path:
==2962== Source and destination overlap in strcpy(0x459F068, 0x459F06A)
==2962==    at 0x4026056: strcpy (mc_replace_strmem.c:268)
==2962==    by 0x808F70B: canonicalize_pathname (string3.h:106)
==2962==    by 0x805ECBA: filename_completion_function (complete.c:125)
==2962==    by 0x805FB35: command_completion_function (complete.c:448)
==2962==    by 0x805EA34: completion_matches (complete.c:552)
==2962==    by 0x8060454: complete (complete.c:735)
==2962==    by 0x809AAC4: handle_char (widget.c:1545)
==2962==    by 0x807867E: midnight_callback (dialog.h:201)
==2962==    by 0x8061B27: dlg_process_event (dialog.c:664)
==2962==    by 0x8061ECE: run_dlg (dialog.c:786)
==2962==    by 0x807996C: main (main.c:1674)

Snippet of man strcpy:
DESCRIPTION
       The  strcpy()  function copies the string pointed to by src, including the terminating
       null byte ('\0'), to the buffer pointed to by dest.  ___The strings may not overlap___,
       and the destination string dest must be  large enough to receive the copy.
We used strcpy to move data chunk in memory: "./foo" -> "foo", etc.

This patch introduces mhl_strmove and fixed canonicalize_pathname.

Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
2009-01-30 09:31:28 +02:00
Sergei Trofimovich
c825c379c4 fish: cleanup: unboxed quoted strings when generate shell commands
Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
2009-01-28 10:29:18 +02:00
Enrico Weigelt, metux IT service
90763ba82f introduced new type SHELL_ESCAPED_STR for more type safety 2009-01-27 22:27:06 +01:00
Enrico Weigelt, metux IT service
2f6f6af425 fixed comments to /* ... */ 2009-01-27 22:04:12 +01:00
Enrico Weigelt, metux IT service
6674647676 added mhl/types.h which defines bool enum, escape.h now using this type 2009-01-27 21:53:41 +01:00
Slava Zanko
38537ddd04 Changes for use MHL.
mhl/escape.h:
    add new function mhl_shell_is_char_escaped()

src/command.c; src/complete.c; src/file.c; src/util.c:
    Changes for use MHL-functions.

src/util.h:
    remove old escape-related declarations of functions
2009-01-27 10:20:35 +02:00
Patrick Winnertz
3dd8716646 Not only comment it out but removing it 2009-01-26 21:51:40 +01:00
Patrick Winnertz
89d3cbddd2 Removed unneeded var to make build process a bit cleaner 2009-01-26 21:29:25 +01:00
Sergei Trofimovich
636b1ff16f fish: added handling for escaped characters
Changes:
 * mhl/string.h achieved new function: mhl_str_dup_range
 * fish: added handling for quoted string (:"enc" and :"enc1" -> "enc2")

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-01-25 20:22:29 +01:00
Patrick Winnertz
b79649fd54 Corrected names of the header files in the README for mhl 2009-01-23 20:07:32 +01:00
Enrico Weigelt, metux IT service
272754a8f5 renamed ../mhl/mhl* to <mhl/...> 2009-01-19 02:31:04 +01:00
Enrico Weigelt, metux IT service
74c1fd9d11 changed includes from ../mhl/ to <mhl/...> 2009-01-16 20:16:05 +01:00
Patrick Winnertz
5f1140f894 Renamed all mhl files as some of them are also present under /usr/include
with the same name:
 - memory.h
 - string.h
In order to do not have two .h files with the same name these two needs to be renamed.
I've renamed the others too, in order to have the same naming rules here.

Updated README to reflect this change
2009-01-16 11:50:10 +01:00
Patrick Winnertz
01e12904bf Revert patches from slavaz and moved them into a separate branch
since this should go into 4.6.2
2009-01-15 14:10:45 +01:00
Slava Zanko
4eee697592 Create some function for init recode stuff. 2009-01-14 16:10:47 +02:00
Slava Zanko
b79817bdb8 Added empty files mhl_recode.[ch]
In future these files will deprecate src/charsets.[ch]
2009-01-14 13:45:52 +02:00
Slava Zanko
521fe2fefb Add .gitignore to mhl dir. 2009-01-14 13:21:58 +02:00
Slava Zanko
51a81ec6e3 mhl/string.c: rename to mhl_string.c
mhl/string.h: rename to mhl_string.h
mhl/memory.h:
 - Remove REGEX_MALLOC
 - avoid "alloca redefined" warning
2009-01-14 12:48:12 +02:00
Slava Zanko
c9bdf6f0a4 Make compileable mhl library.
Create mhl/string.c file
2009-01-13 17:35:02 +02:00
Slava Zanko
14b078b908 Add support of GLIB library. 2009-01-13 16:24:41 +02:00
Patrick Winnertz
60e84fdba8 use size_t where needed. 2009-01-13 07:32:14 +01:00
Enrico Weigelt, metux IT service
456e41a2a2 removed mhl_str_concat_XXX() inlines 2009-01-12 21:42:45 +01:00
Enrico Weigelt, metux IT service
be3a8e13f9 variable args implementation of mhl_str_concat 2009-01-11 23:59:57 +01:00
Patrick Winnertz
c3a8fe91c8 make the concat stuff a bit more variable and use stdarg.h for this 2009-01-11 23:59:57 +01:00
Enrico Weigelt, metux IT service
e2acd70013 added the mhl/ subdir - micro helper library 2009-01-11 23:59:57 +01:00