Re: wcscpy.3 mentions nonexistent EXAMPLES section in strcpy.3

2016-11-11 Thread Jason McIntyre
On Fri, Nov 11, 2016 at 09:10:50PM -0600, Scott Cheloha wrote:
> Hi,
> 
> The end of lib/libc/string/wcscpy.3 reads:
> 
>   CAVEATS 
>   Using the functions wcscpy() and wcsncpy() is very error-prone 
> with
>   respect to buffer overflows; see the EXAMPLES section in 
> strcpy(3) for 
>   correct usage. Using wcslcpy(3) is a better choice in most 
> cases.
> 
> But lib/libc/string/strcpy.3 has no EXAMPLES section.
> 
> Seen on OpenBSD 6.0 AMD64 (installed from the CD media), still present in CVS.
> 
> Cheers,
> Scott Cheloha

morning.

a few years ago the strcpy.3 page got split in order to create the
strncpy.3 page. the EXAMPLES section went to that page, so i'm guessing
that's where the reference should lie. it's a tough kind of thing to
check when you make such changes.

diff below. i'll commit it shortly if i don;t hear otherwise.
jmc

Index: wcscpy.3
===
RCS file: /cvs/src/lib/libc/string/wcscpy.3,v
retrieving revision 1.4
diff -u -r1.4 wcscpy.3
--- wcscpy.325 Sep 2013 21:49:31 -  1.4
+++ wcscpy.312 Nov 2016 07:58:15 -
@@ -122,7 +122,7 @@
 .Fn wcsncpy
 is very error-prone with respect to buffer overflows;
 see the EXAMPLES section in
-.Xr strcpy 3
+.Xr strncpy 3
 for correct usage.
 Using
 .Xr wcslcpy 3



wcscpy.3 mentions nonexistent EXAMPLES section in strcpy.3

2016-11-11 Thread Scott Cheloha
Hi,

The end of lib/libc/string/wcscpy.3 reads:

CAVEATS 
Using the functions wcscpy() and wcsncpy() is very error-prone 
with
respect to buffer overflows; see the EXAMPLES section in 
strcpy(3) for 
correct usage. Using wcslcpy(3) is a better choice in most 
cases.

But lib/libc/string/strcpy.3 has no EXAMPLES section.

Seen on OpenBSD 6.0 AMD64 (installed from the CD media), still present in CVS.

Cheers,
Scott Cheloha


Re: FW: smtpd dies on current

2016-11-11 Thread Giovanni Bechis
On 11/11/16 18:22, Gilles Chehade wrote:
> On Fri, Nov 11, 2016 at 05:54:06PM +0100, Giovanni Bechis wrote:
>> On 11/11/16 17:08, Ricardo Mestre wrote:
>>> Hi,
>>>
>>> I can confirm this, just alerted gilles@ of the issue, essentially it's 
>>> this:
>>>
>>> "So basically I'm able to receive emails, no problem there, but when I try 
>>> to
>>> relay an email to the internet using my ISP's server as soon as STARTTLS is
>>> sent then the lka process receives a SIGCHLD with errno 4 (interrupted 
>>> syscall)
>>> which is due to a kevent(2) call. At first I thought it must have been my 
>>> ISP's
>>> fault so I also tried Gmail, but the issue reveals itself exactly the same."
>>>
>>> This is most likely some of the several changes made lately to LibreSSL and
>>> that smtpd(8) didn't update some function(s).
>>>
>>> Please find attached the ktrace and debug logs of showing this happening.
>>>
>> some more infos coming from mutt attached: 
>> #0  ASN1_STRING_free (a=0xdfdfdfdfdfdfdfdf)
>> at /usr/src/lib/libcrypto/asn1/asn1_lib.c:439
>> 439 if (a->data != NULL && !(a->flags & ASN1_STRING_FLAG_NDEF)) {
>>
> 
> so you also have mutt crashing ?
> 
yes, when connecting to imaps, before logging in; I think it's when the 
certificate is verified.
 Giovanni
 
> smtpd has a stack within asn1 too:
> 
> Program received signal SIGBUS, Bus error.
> (gdb) where
> #0  ASN1_STRING_free (a=0xdfdfdfdfdfdfdfdf) at 
> /usr/src/lib/libcrypto/asn1/asn1_lib.c:439
> #1  0x00773fbeb55f in ASN1_primitive_free (pval=0x76ff2a9f10, 
> it=0x773fef3e40) at /usr/src/lib/libcrypto/asn1/tasn_fre.c:239
> #2  0x00773fbeb907 in ASN1_template_free (pval=0x76ff2a9f10, 
> tt=0x773ff0a030) at /usr/src/lib/libcrypto/asn1/tasn_fre.c:185
> #3  0x00773fbeb7f3 in asn1_item_combine_free (pval=0x7f7efab0, 
> it=0x773ff01ba0, combine=0)
> at /usr/src/lib/libcrypto/asn1/tasn_fre.c:158
> #4  0x00773fbeb942 in ASN1_item_free (val=0x76ff2a9f00, it=Variable "it" 
> is not available.
> ) at /usr/src/lib/libcrypto/asn1/tasn_fre.c:73
> #5  0x00773fc2b62f in X509_INFO_free (x=0x76862e5e00) at 
> /usr/src/lib/libcrypto/asn1/x_info.c:100
> #6  0x00773fba2690 in sk_pop_free (st=0x76f2b45640, func=0x773fc2b5f0 
> )
> at /usr/src/lib/libcrypto/stack/stack.c:281
> #7  0x00773fc27b3b in X509_load_cert_crl_file (ctx=0x76862e7e20, 
> file=Variable "file" is not available.
> ) at /usr/src/lib/libcrypto/x509/by_file.c:271
> #8  0x00773fc27c0d in by_file_ctrl (ctx=0x76862e7e20, cmd=Variable "cmd" 
> is not available.
> ) at /usr/src/lib/libcrypto/x509/by_file.c:101
> #9  0x00773fba3f94 in X509_STORE_set_default_paths (ctx=0x771ab1c000) at 
> /usr/src/lib/libcrypto/x509/x509_d2.c:74
> 
> 



Re: FW: smtpd dies on current

2016-11-11 Thread Giovanni Bechis
On 11/11/16 17:08, Ricardo Mestre wrote:
> Hi,
> 
> I can confirm this, just alerted gilles@ of the issue, essentially it's this:
> 
> "So basically I'm able to receive emails, no problem there, but when I try to
> relay an email to the internet using my ISP's server as soon as STARTTLS is
> sent then the lka process receives a SIGCHLD with errno 4 (interrupted 
> syscall)
> which is due to a kevent(2) call. At first I thought it must have been my 
> ISP's
> fault so I also tried Gmail, but the issue reveals itself exactly the same."
> 
> This is most likely some of the several changes made lately to LibreSSL and
> that smtpd(8) didn't update some function(s).
> 
> Please find attached the ktrace and debug logs of showing this happening.
> 
some more infos coming from mutt attached: 
#0  ASN1_STRING_free (a=0xdfdfdfdfdfdfdfdf)
at /usr/src/lib/libcrypto/asn1/asn1_lib.c:439
439 if (a->data != NULL && !(a->flags & ASN1_STRING_FLAG_NDEF)) {


 Giovanni


> mestre@
> 
> On 09:33 Fri 11 Nov , Ted Wynnychenko wrote:
>> I tried sending this to bugs@, but it does not seem to have been accepted.
>> So, I decide to send it to misc@.
>> I hope that's ok.
>>
>> -Original Message-
>> Sent: Friday, November 11, 2016 8:44 AM
>> To: 'bugs@openbsd.org'
>> Subject: smtpd dies on current
>>
>> Hello
>> I updated current a few days ago.
>> At that point, I noticed that no mail was going out.
>> Looking at /var/log/maillog, I saw that smtpd was dying with a fatal error
>> immediately on startup.
>>
>> I just updated again to the new snapshot.
>> Same problem.
>> I hope this is the right place to send this, and that I have included enough
>> information.
>> I can't directly use sendbug, since the system can't send the mail out...
>>
>> But, from sendbug:
>>
>>> Synopsis:  sendmail dies on startup with fatal error
>>> Category:  
>>> Environment:
>> System  : OpenBSD 6.0
>> Details : OpenBSD 6.0-current (GENERIC.MP) #0: Thu Nov 10 
>> 22:14:46
>> MST 2016
>>  
>> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>>
>> Architecture: OpenBSD.amd64
>> Machine : amd64
>>> Description:
>> When booting up, or starting smtpd manually, the demon dies with a 
>> fatal
>> error
>> From /var/log/maillog:
>>
>> Nov 11 08:24:21 system smtpd[31422]: info: OpenSMTPD 6.0.0 starting
>> Nov 11 08:24:22 system smtpd[17404]: ab291948ab3ce73f mta event=connecting
>> address=tls://96.114.157.81:587 host=omta-po.sys.comcast.net
>> Nov 11 08:24:22 system smtpd[17404]: ab291948ab3ce73f mta event=connected
>> Nov 11 08:24:22 system smtpd[17404]: ab291949645ed964 smtp event=connected
>> address=local host=system.domain.com
>> Nov 11 08:24:22 system smtpd[17404]: ab29194ca0da4904 smtp event=connected
>> address=local host=system.domain.com
>> Nov 11 08:24:22 system smtpd[17404]: ab2919546f1001e9 smtp event=connected
>> address=local host=system.domain.com
>> Nov 11 08:24:22 system smtpd[17404]: ab2919563f86cc18 smtp event=connected
>> address=local host=system.domain.com
>> Nov 11 08:24:22 system smtpd[17404]: ab291949645ed964 smtp event=message
>> address=local host=system.domain.com msgid=3dc96514
>> from= to= size=8083 ndest=1
>> proto=ESMTP
>> Nov 11 08:24:22 system smtpd[17404]: ab29194ca0da4904 smtp event=message
>> address=local host=system.domain.com msgid=791261cf
>> from= to= size=704 ndest=1
>> proto=ESMTP
>> Nov 11 08:24:22 system smtpd[17404]: ab291949645ed964 smtp event=closed
>> address=local host=system.domain.com reason=quit
>> Nov 11 08:24:22 system smtpd[17404]: ab29194ca0da4904 smtp event=closed
>> address=local host=system.domain.com reason=quit
>> Nov 11 08:24:22 system smtpd[17404]: ab291967e3dfd3fa smtp event=connected
>> address=local host=system.domain.com
>> Nov 11 08:24:22 system smtpd[17404]: ab2919546f1001e9 smtp event=message
>> address=local host=system.domain.com msgid=c62f2f22
>> from= to= size=95641 ndest=1
>> proto=ESMTP
>> Nov 11 08:24:22 system smtpd[17404]: ab2919546f1001e9 smtp event=closed
>> address=local host=system.domain.com reason=quit
>> Nov 11 08:24:22 system smtpd[17404]: ab2919563f86cc18 smtp event=message
>> address=local host=system.domain.com msgid=3ac75830
>> from= to= size=65992 ndest=1
>> proto=ESMTP
>> Nov 11 08:24:22 system smtpd[17404]: ab2919563f86cc18 smtp event=closed
>> address=local host=system.domain.com reason=quit
>> Nov 11 08:24:22 system smtpd[17404]: ab291967e3dfd3fa smtp event=message
>> address=local host=system.domain.com msgid=16b1e1ba
>> from= to= size=95641 ndest=1
>> proto=ESMTP
>> Nov 11 08:24:22 system smtpd[17404]: ab291967e3dfd3fa smtp event=closed
>> address=local host=system.domain.com reason=quit
>> Nov 11 08:24:22 system smtpd[17404]: