Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2021-01

Patches for Issue #37906 - DNS over TCP

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Noel Duffy

I've added patches to resolve issue #37906, DNS over TCP, to the bug tracker:

https://bugs.freepascal.org/view.php?id=37906

I've broken the changes into three patches:

1. netdb.patch, which updates packages/fcl-net/src/netdb.pp, adding support for DNS over TCP
2. netdb-example.patch, which adds an example program to packages/fcl-net/examples and adds it to packages/fcl-net/examples/Makefile.fpc
3. netdb-tests.patch, which adds unit tests to packages/fcl-net/tests and updates tests/Makefile.fpc to add the new tests to the build system

I've created separate patches to simplify applying them. If there's a problem with one, the others should still be OK.

In addition to new code for DNS over TCP, this latest set of patches adds checks for writes beyond buffer boundaries and other potential security issues. Since the last update I've also added support for SRV records, as defined in RFC 2782.

Cheers,
Noel.

Reply by email

Michael Van Canneyt
to Noel Duffy
Noel Duffy wrote 21 lines
I've added patches to resolve issue #37906, DNS over TCP, to the bug tracker: https://bugs.freepascal.org/view.php?id=37906 I've broken the changes into three patches: 1. netdb.patch, which updates packages/fcl-net/src/netdb.pp, adding support for DNS over TCP 2. netdb-example.patch, which adds an example program to packages/fcl-net/examples and adds it to packages/fcl-net/examples/Makefile.fpc 3. netdb-tests.patch, which adds unit tests to packages/fcl-net/tests and updates tests/Makefile.fpc to add the new tests to the build system I've created separate patches to simplify applying them. If there's a problem with one, the others should still be OK. In addition to new code for DNS over TCP, this latest set of patches adds checks for writes beyond buffer boundaries and other potential security issues. Since the last update I've also added support for SRV records, as defined in RFC 2782.

Very nice indeed !! I checked your patches, they're all applied.

Thank you very much for this contribution !

Michael.

Reply by email

Noel Duffy
to Michael Van Canneyt
Michael Van Canneyt wrote 19 lines
On Sat, 30 Jan 2021, Noel Duffy via fpc-pascal wrote: > I've added patches to resolve issue #37906, DNS over TCP, to the bug tracker: > > https://bugs.freepascal.org/view.php?id=37906 > > I've broken the changes into three patches: > > 1. netdb.patch, which updates packages/fcl-net/src/netdb.pp, adding support for DNS over TCP > 2. netdb-example.patch, which adds an example program to packages/fcl-net/examples and adds it to packages/fcl-net/examples/Makefile.fpc > 3. netdb-tests.patch, which adds unit tests to packages/fcl-net/tests and updates tests/Makefile.fpc to add the new tests to the build system > > I've created separate patches to simplify applying them. If there's a problem with one, the others should still be OK. > > In addition to new code for DNS over TCP, this latest set of patches adds checks for writes beyond buffer boundaries and other potential security issues. Since the last update I've also added support for SRV records, as defined in RFC 2782. Very nice indeed !! I checked your patches, they're all applied.

Great stuff! Thanks Michael. As always, I wonder if you ever sleep! :-D

Thank you very much for this contribution !

Happy to do so.

With regard to documentation, I've not written anything yet, and it seems I'm as well placed as anyone to do it. That said, I'm completely unfamiliar with generating documentation from source in FPC. But there's just one way to learn, I suppose!

Lastly, a minor point: in the source for netdb.pp there's a comment warning of stringfromlabel's lack of checks. Since it now has a good few checks, I think this warning is superfluous. But I didn't want to remove it without checking, in case there's more to it than meets the eye.

Reply by email

Sven Barth
to Noel Duffy
Noel Duffy wrote 32 lines
On 30/01/21 9:45 pm, Michael Van Canneyt via fpc-pascal wrote: > > > On Sat, 30 Jan 2021, Noel Duffy via fpc-pascal wrote: > >> I've added patches to resolve issue #37906, DNS over TCP, to the bug >> tracker: >> >> https://bugs.freepascal.org/view.php?id=37906 >> >> I've broken the changes into three patches: >> >> 1. netdb.patch, which updates packages/fcl-net/src/netdb.pp, adding >> support for DNS over TCP >> 2. netdb-example.patch, which adds an example program to >> packages/fcl-net/examples and adds it to >> packages/fcl-net/examples/Makefile.fpc >> 3. netdb-tests.patch, which adds unit tests to >> packages/fcl-net/tests and updates tests/Makefile.fpc to add the new >> tests to the build system >> >> I've created separate patches to simplify applying them. If there's >> a problem with one, the others should still be OK. >> >> In addition to new code for DNS over TCP, this latest set of patches >> adds checks for writes beyond buffer boundaries and other potential >> security issues. Since the last update I've also added support for >> SRV records, as defined in RFC 2782. > > Very nice indeed !! I checked your patches, they're all applied. Great stuff! Thanks Michael. As always, I wonder if you ever sleep! :-D

Michael applied that around 9 o'clock CET, which is a rather normal time for us Europeans to be awake. ;)

With regard to documentation, I've not written anything yet, and it seems I'm as well placed as anyone to do it. That said, I'm completely unfamiliar with generating documentation from source in FPC. But there's just one way to learn, I suppose!

You can take a look here for first steps:
https://wiki.freepascal.org/FPDoc_Editor

Regards,
Sven

Reply by email

Michael Van Canneyt
to Noel Duffy: Great stuff! Thanks Michael. As always, I wonder if you ever sleep! :-D Happy to do so.…
Noel Duffy wrote 31 lines
On 30/01/21 9:45 pm, Michael Van Canneyt via fpc-pascal wrote: > > > On Sat, 30 Jan 2021, Noel Duffy via fpc-pascal wrote: > >> I've added patches to resolve issue #37906, DNS over TCP, to the bug tracker: >> >> https://bugs.freepascal.org/view.php?id=37906 >> >> I've broken the changes into three patches: >> >> 1. netdb.patch, which updates packages/fcl-net/src/netdb.pp, adding support for DNS over TCP >> 2. netdb-example.patch, which adds an example program to packages/fcl-net/examples and adds it to packages/fcl-net/examples/Makefile.fpc >> 3. netdb-tests.patch, which adds unit tests to packages/fcl-net/tests and updates tests/Makefile.fpc to add the new tests to the build system >> >> I've created separate patches to simplify applying them. If there's a problem with one, the others should still be OK. >> >> In addition to new code for DNS over TCP, this latest set of patches adds checks for writes beyond buffer boundaries and other potential security issues. Since the last update I've also added support for SRV records, as defined in RFC 2782. > > Very nice indeed !! I checked your patches, they're all applied. Great stuff! Thanks Michael. As always, I wonder if you ever sleep! :-D

Less and less with age ;-)

Show quoted text 15 lines
> > Thank you very much for this contribution ! Happy to do so. With regard to documentation, I've not written anything yet, and it seems I'm as well placed as anyone to do it. That said, I'm completely unfamiliar with generating documentation from source in FPC. But there's just one way to learn, I suppose! Lastly, a minor point: in the source for netdb.pp there's a comment warning of stringfromlabel's lack of checks. Since it now has a good few checks, I think this warning is superfluous. But I didn't want to remove it without checking, in case there's more to it than meets the eye.

I also noticed this, but decided to leave it for the moment. if you feel it can be removed, I'll trust your judgment on that.

Michael.

Reply by email

Michael Van Canneyt
to Sven Barth: Michael applied that around 9 o'clock CET, which is a rather normal time for us Europeans…
Sven Barth wrote 11 lines
>>> In addition to new code for DNS over TCP, this latest set of patches >>> adds checks for writes beyond buffer boundaries and other potential >>> security issues. Since the last update I've also added support for >>> SRV records, as defined in RFC 2782. >> >> Very nice indeed !! I checked your patches, they're all applied. > > Great stuff! Thanks Michael. As always, I wonder if you ever sleep! :-D Michael applied that around 9 o'clock CET, which is a rather normal time for us Europeans to be awake. ;)

Depends on when you go to bed. If I try to wake my daughter at 9AM, I risk my life ;)

Michael.

Reply by email

Noel Duffy
to Michael Van Canneyt: Less and less with age ;-) I also noticed this, but decided to leave it for the moment.…
Michael Van Canneyt wrote 8 lines
On Sat, 30 Jan 2021, Noel Duffy via fpc-pascal wrote: > > Lastly, a minor point: in the source for netdb.pp there's a comment warning of stringfromlabel's lack of checks. Since it now has a good few checks, I think this warning is superfluous. But I didn't want to remove it without checking, in case there's more to it than meets the eye. I also noticed this, but decided to leave it for the moment. if you feel it can be removed, I'll trust your judgment on that.

My vote is to remove the comment. While it may have been justified in the past, the current version of stringfromlabel is reasonably robust and resilient to the most obvious kinds of attack, in my opinion. Now, I'm not a security researcher and haven't done any serious fuzzing attacks against it, so all I can say is that stringfromlabel is about as safe as the rest of the code in netdb.pp.

Reply by email