[patch] nm: minimal section header size

2015-06-19 Thread Sébastien Marie
as Elf_Shdr[] (array of Elf_Shdr: which is a fixed element size). While here, inverts calloc() arguments to be calloc(nmemb, size), according to fread() call after. This problem was found with afl, when e_shentsize was 1. -- Sébastien Marie Index: b/usr.bin/nm/elf.c

[patch] nm: some code cleanup

2015-06-19 Thread Sébastien Marie
in this direction for now. - change some if(x) free(x) idioms to free(x) -- Sébastien Marie Index: elf.c === RCS file: /cvs/src/usr.bin/nm/elf.c,v retrieving revision 1.28 diff -u -p -r1.28 elf.c --- elf.c 17 May 2015 20:19:08

[patch] nm: on error, set globals to NULL

2015-06-19 Thread Sébastien Marie
Hi, This patch ensure that when an error is detected, the freed variables in elf_symloadx() are reinitialised. Else show_file() in nm.c will used these variables, even if they has just been freed. (nm.c +689). Problem found by afl. -- Sébastien Marie Index: elf.c

[patch] nm segfault

2015-06-17 Thread Sébastien Marie
=0 (no section header table), so shdr is an zero sized object. The patch adds two check: - e_shnum == 0: no section header table - a consistency check (should prevent craft object-file to generate out-of-bound read). Maybe a check for overflow would be needed too ? -- Sébastien Marie

Re: [patch] nm segfault

2015-06-17 Thread Sébastien Marie
On Wed, Jun 17, 2015 at 02:43:41PM +0200, Sébastien Marie wrote: Hi, I would like to report a SEGFAULT in nm(1) that occurs with object-file with no section headers (e_shnum = 0). Index: elf.c === RCS file: /cvs/src

[patch] nm: read after bound

2015-06-17 Thread Sébastien Marie
Hi, This patch corrects a read after bound that occurs in strcmp (line just after the added bound check). Found with afl. -- Sébastien Marie Index: elf.c === RCS file: /cvs/src/usr.bin/nm/elf.c,v retrieving revision 1.28 diff -u

patch: catopen(3), locale setting and getenv

2015-06-12 Thread Sébastien Marie
? -- Sébastien Marie Index: nls/catopen.c === RCS file: /cvs/src/lib/libc/nls/catopen.c,v retrieving revision 1.16 diff -u -p -r1.16 catopen.c --- nls/catopen.c 16 Jan 2015 16:48:51 - 1.16 +++ nls/catopen.c 12 Jun 2015

Re: patch: catopen(3), locale setting and getenv

2015-06-12 Thread Sébastien Marie
On Fri, Jun 12, 2015 at 10:35:02AM +0200, Stefan Sperling wrote: On Fri, Jun 12, 2015 at 08:59:14AM +0200, Sébastien Marie wrote: If this change is desirable, I will propose patchs for programs in base in order to call setlocale(LC_ALL, ) at program initilisation. Calling setlocale

patch: libc/locale/setlocale.c new_categories variable (2)

2015-06-12 Thread Sébastien Marie
name (locname), and used it in loadlocate() body for: - check if the wanted value is already set - effectively load the locale (load_locale_sub call) - effectively assign the value in current_categories -- Sébastien Marie Index: locale/setlocale.c

patch: libc/locale/setlocale.c new_categories variable (3 and last)

2015-06-12 Thread Sébastien Marie
from global to local variable of setlocale(). -- Sébastien Marie Index: locale/setlocale.c === RCS file: /cvs/src/lib/libc/locale/setlocale.c,v retrieving revision 1.21 diff -u -p -r1.21 setlocale.c --- locale/setlocale.c 9 Jun

patch: libc/locale/setlocale.c new_categories variable (1)

2015-06-12 Thread Sébastien Marie
() is called only at one place in loadlocale(): if (!load_locale_sub(category, new_categories[category])) { The second argument (locname) of load_locale_sub() is always defined with new_categories[category]. So we could replace new_categories[category] by locname in function body. -- Sébastien

[patch] libc/locale/setlocale.c: remove unused arg

2015-06-09 Thread Sébastien Marie
Hi, I start reading libc/locale code in order to understanding it. Here a patch to remove an unused argument isspecial from static function load_locale_sub. The function is called once, with isspecial=0, and the argument isn't used in function's body. Any comments ? -- Sébastien Marie Index

Re: [patch] file(1) determine file type of stdin

2015-05-29 Thread Sébastien Marie
is used with O_NONBLOCK ? But, if it isn't need it could be removed from my patch. -- Sébastien Marie

[patch] file(1) adjust size in fill_buffer

2015-05-29 Thread Sébastien Marie
, considering garbage as potential data. before: --- $ echo foobar | file -s /dev/stdin /dev/stdin: data after: -- $ echo foobar | file -s /dev/stdin /dev/stdin: ASCII text Thanks. -- Sébastien Marie Index: file.c === RCS file

Re: [patch] file(1) determine file type of stdin

2015-05-29 Thread Sébastien Marie
'./-' (No such file or directory) Thanks. -- Sébastien Marie Index: file.1 === RCS file: /cvs/src/usr.bin/file/file.1,v retrieving revision 1.41 diff -u -p -r1.41 file.1 --- file.1 27 Apr 2015 11:12:49 - 1.41 +++ file.1

Re: [patch] file(1) determine file type of stdin

2015-05-29 Thread Sébastien Marie
) [1] 18981 5.5$ file -s test test: ASCII text Next a slightly modified patch. -- Sébastien Marie Index: file.1 === RCS file: /cvs/src/usr.bin/file/file.1,v retrieving revision 1.41 diff -u -p -r1.41 file.1 --- file.1

[patch] correct file(1) printed usage

2015-05-28 Thread Sébastien Marie
Hi, I would report (and correct) an invalid usage statement of file(1). $ file usage: file [-bchiLsW] [file ...] $ man file | grep -A1 'SY' SYNOPSIS file [-bchiLsW] file ... As at least one argument is mandatory, removing the [] would make sens. Thanks. -- Sébastien Marie Index

[patch] file(1) determine file type of stdin

2015-05-28 Thread Sébastien Marie
'-' implies '-s' (as before) ? - should I rename - to /dev/stdin in order to have similar output than before ? - why file -s /dev/stdin returns data instead of proper determination ? - should I trait /dev/stdin as STDIN_FILENO too ? Thanks. -- Sébastien Marie Index: file.1

Re: bug/inconsistency in OpenBSD sed(1) vs. FreeBSD sed(1) [patch]

2015-05-09 Thread Sébastien Marie
On Sat, May 09, 2015 at 06:47:05AM +0200, Sébastien Marie wrote: Hi, Here a small patch to sed to make 'i' and 'a' command to always append \n after 'text'. While here, remove 'len' field from 'struct s_appends'. It was just used for AP_STRING (used for 'a' command), and the switch from

Re: bug/inconsistency in OpenBSD sed(1) vs. FreeBSD sed(1) [patch]

2015-05-08 Thread Sébastien Marie
for 'a' command), and the switch from fwrite to printf permit to not use it. -- Sébastien Marie Index: defs.h === RCS file: /cvs/src/usr.bin/sed/defs.h,v retrieving revision 1.5 diff -u -p -r1.5 defs.h --- defs.h 19 Jan 2015 15:30:52 -

file: crash with invalid magic file (+ patch)

2015-04-25 Thread Sébastien Marie
: the function magic_get_string, used for get the JFIF\ string, miss the end-of-line due to '\' char, resulting processing outside the line variable. Problem found using afl-fuzz. The proposed diff ensure '\0' is correctly detected, and return an error (can't parse string). -- Sébastien Marie Index

PATCH: ksh: parsing problem: quote in comment in command substitution

2015-03-08 Thread Sébastien Marie
On Sat, Mar 07, 2015 at 07:16:53AM +0100, Sébastien Marie wrote: Hi, I encounter a problem of parsing in ksh(1): a quote in a comment in a command substitution $(...) or `...` is parsed as quote and a closing quote is expected. Here code snippet that expose the problem: $ cat test.sh

[patch] sed: segfault due to use of initialized variable

2014-12-10 Thread Sébastien Marie
warning too (with -Wall -O2). Thanks. -- Sébastien Marie Index: process.c === RCS file: /cvs/src/usr.bin/sed/process.c,v retrieving revision 1.20 diff -u -p -r1.20 process.c --- process.c 1 Dec 2014 06:37:25 - 1.20

[patch] sed: missing bound check resulting stack overflow

2014-12-10 Thread Sébastien Marie
. Thanks. -- Sébastien Marie Index: compile.c === RCS file: /cvs/src/usr.bin/sed/compile.c,v retrieving revision 1.36 diff -u -p -r1.36 compile.c --- compile.c 8 Oct 2014 04:19:08 - 1.36 +++ compile.c 10 Dec 2014 10:03:51

Re: [patch] sed: missing bound check resulting stack overflow

2014-12-10 Thread Sébastien Marie
On Wed, Dec 10, 2014 at 11:16:21AM +0100, Sébastien Marie wrote: Hi, In compile_flags, the variable holding the filename ('w' flag of 's' command) is an array with PATH_MAX length. We should check the size of wanted filename, before copying it in wfile. $ echo | sed -e s/a//w`perl -e

Re: [patch] sed: missing bound check resulting stack overflow

2014-12-10 Thread Sébastien Marie
On Wed, Dec 10, 2014 at 11:16:21AM +0100, Sébastien Marie wrote: Hi, In compile_flags, the variable holding the filename ('w' flag of 's' command) is an array with PATH_MAX length. We should check the size of wanted filename, before copying it in wfile. $ echo | sed -e s/a//w`perl -e

Re: [patch] sed: missing bound check resulting stack overflow

2014-12-10 Thread Sébastien Marie
two cells at end. As simple test, defining wfile to char wfile[2], don't permit to save to any filename, whereas one-char filename should be ok. $ echo | sed -e s/a//w_ sed: 1: s/a//w_: wfile too long I think the test should be if (q = eq). -- Sébastien Marie On Wed, Dec 10, 2014 at 10:25:11PM

Re: [patch] sed: segfault due to use of initialized variable

2014-12-10 Thread Sébastien Marie
On Wed, Dec 10, 2014 at 10:05:49PM +1100, Jonathan Gray wrote: On Wed, Dec 10, 2014 at 10:39:37AM +0100, Sébastien Marie wrote: Hi, Fuzzing sed with afl, I found a crash due to use of uninitialized variable. In process.c oldpsl variable need to be initialized: $ echo | sed

Re: [patch] sed: missing bound check resulting stack overflow

2014-12-10 Thread Sébastien Marie
On Thu, Dec 11, 2014 at 04:38:50PM +1100, Jonathan Gray wrote: Yes, I agree. I plan to commit this version: It is ok for me. Thanks. Sébastien Marie Index: compile.c === RCS file: /cvs/src/usr.bin/sed/compile.c,v

patch: correct double-free in dc(1)

2014-11-24 Thread Sébastien Marie
, and the array A too (as != NULL) - it pops the array B - it will try to set B[1] = 1, so it free B[1], which is A, which is already freed: *boom*. The patch just ensure a push_number (or push_string) properly initialize the value, by set value.array to NULL. -- Sébastien Marie Index

Re: tplink TL-WN722N (ath ar9271): athn0: could not load firmware (and firmware is there)

2014-09-25 Thread Sébastien Marie
/1.08 addr 2 athn0: AR9271 rev 1 (1T1R), ROM rev 13, address c0:4a:00:1c:c0:aa -- Sébastien Marie

Re: patch: acpitz: active cooling and notify 0x81

2014-09-19 Thread Sébastien Marie
to sc_ac_stat when _ALx change, as sc_ac_stat reflect the _STA value of _ALx Thanks. -- Sébastien Marie Index: acpitz.c === RCS file: /cvs/src/sys/dev/acpi/acpitz.c,v retrieving revision 1.47 diff -u -p -r1.47 acpitz.c --- acpitz.c

Re: patch: acpitz: active cooling and notify 0x81

2014-09-15 Thread Sébastien Marie
ping ? Tihs patch is very conservative: it just allow to switch fan OFF if state is unknown. Thanks. -- Sébastien Marie On Wed, Aug 27, 2014 at 02:51:20PM +0200, Sébastien Marie wrote: Hi Jonathan, First, thanks for your feedback and for your patch. On Wed, Aug 27, 2014 at 02:42:43AM

Re: patch: acpitz: active cooling and notify 0x81

2014-08-27 Thread Sébastien Marie
is negligible, it is ok for me. I join a very conservative patch which just allow calling acpi_setfan(sc,i,_OFF) if cache is unknown. Thanks. -- Sébastien Marie Index: dev/acpi/acpitz.c === RCS file: /cvs/src/sys/dev/acpi/acpitz.c,v

patch: acpitz: active cooling and notify 0x81

2014-08-21 Thread Sébastien Marie
call acpitz_setfan(OFF) when sc_ac_stat == -1. Thanks to comment. -- Sébastien Marie Index: src-sys-current/dev/acpi/acpitz.c === --- src-sys-current.orig/dev/acpi/acpitz.c +++ src-sys-current/dev/acpi/acpitz.c @@ -141,6 +141,7

Re: patch: acpitz: active cooling and notify 0x81 (patch v2)

2014-08-21 Thread Sébastien Marie
On Thu, Aug 21, 2014 at 10:44:36AM +0200, Sébastien Marie wrote: Hi, Another possibility (not tested) should be to change active cooling code to permit call acpitz_setfan(OFF) when sc_ac_stat == -1. Next is the patch that implement the other possibility (the code is running, currently fan

man.cgi: clean exit when absent or empty manpath.conf

2014-07-18 Thread Sébastien Marie
is not NULL (req-q.manpath = req-p[0]). The diff use the same style that when MAN_DIR is invalid (cgi.c:917), but that could be improved using err(3) ? Thanks. -- Sébastien Marie Index: cgi.c === RCS file: /cvs/src/usr.bin/mandoc/cgi.c

Re: PATCH: ftp: allow @ in username for Basic Auth

2014-07-01 Thread Sébastien Marie
with some proxy setting, IIRC. Here's the diff that I settled on after testing. It works also for my use-case. Please note I haven't tested proxy setting (by lake of server to test). Thanks for your help. -- Sébastien Marie

Re: PATCH: ftp: allow @ in username for Basic Auth

2014-06-25 Thread Sébastien Marie
On Tue, Jun 24, 2014 at 10:55:44AM -0700, Philip Guenther wrote: On Tue, Jun 24, 2014 at 9:01 AM, Sébastien Marie semarie-open...@latrappe.fr wrote: As I see not activity or feedback for this one line patch, I think it need more explain ? Sorry, the patch is incorrect; per RFC 3986

Re: PATCH: ftp: allow @ in username for Basic Auth

2014-06-25 Thread Sébastien Marie
On Wed, Jun 25, 2014 at 07:07:30PM -0700, Philip Guenther wrote: On Wed, 25 Jun 2014, S?bastien Marie wrote: On Tue, Jun 24, 2014 at 10:55:44AM -0700, Philip Guenther wrote: On Tue, Jun 24, 2014 at 9:01 AM, S?bastien Marie semarie-open...@latrappe.fr wrote: ... So, I think ftp(1)

Re: PATCH: ftp: allow @ in username for Basic Auth

2014-06-24 Thread Sébastien Marie
), this patch make ftp(1) to more respect standard. Thanks. -- Sébastien Marie On Mon, Jun 23, 2014 at 10:15:25AM +0200, Sébastien Marie wrote: Hi, Using ftp(1) with HTTP(S) scheme and Basic auth, it is currently not possible to have username (or password) with a '@' inner. For example

PATCH: ftp: allow @ in username for Basic Auth

2014-06-23 Thread Sébastien Marie
in user-id or password: user-pass = userid : password userid = *TEXT excluding : password= *TEXT Here a patch to search the last '@' in the string (which don't contains the path at this time). -- Sébastien Marie Index: fetch.c

Re: pkg_add (pkg.conf): option to require signed packages

2014-01-17 Thread Sébastien Marie
On Thu, Jan 16, 2014 at 10:02:22AM +, Stuart Henderson wrote: On 2014/01/16 08:53, Sébastien Marie wrote: Hi, Does it make sens to have an option to require package to be signed ? It makes more sense to just enable that by default, when we are happy with the infrastructure

pkg_add (pkg.conf): option to require signed packages

2014-01-15 Thread Sébastien Marie
Hi, Does it make sens to have an option to require package to be signed ? Currently, a package without signature is gracefully installed without warning. The patch introduce an option require-signature in pkg.conf, and it respects -Dnosig in comand-line, if present. Thanks. -- Sébastien Marie

Remove unused variable in arch/i386/i386/lapic.c

2013-10-26 Thread Sébastien Marie
Hi I have noted that scaled_pentium_mhz variable in i386/lapic.c is defined and initialized, but never used anywhere (grep -R scaled_pentium_mhz /usr/src say nothing [after patch applied]). Remove it ? -- Sébastien Marie Index: arch/i386/i386/lapic.c