Bug 52874
Summary: | nc parses port name with dash incorrectly | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Moritz Barsnick <eedmoba> | ||||||
Component: | nc | Assignee: | Bill Nottingham <notting> | ||||||
Status: | CLOSED RAWHIDE | QA Contact: | David Lawrence <dkl> | ||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | 7.1 | CC: | barsnick, rvokal | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | i386 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2002-06-10 14:26:16 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
Moritz Barsnick
2001-08-30 12:08:45 UTC
The case seems a little tricky in the source code. If the port argument has a dash, it's assumed to be a range (which causes this named bug). If you change the source and decide to _first_ try to check the full arg, the used function getportpoop() will return "okay" even if you hand it a range of numbers, because it uses atoi(), which will take the number before the dash. So I've prepared a patch to use the "dash-checking" section of the code only if the argument is a numeric string. That does the trick for all cases. netcat is a very nice tools, missing just a few little things. It's so unfortunate that it is (or seems) unmaintained. :-( (Although there is "nc6" which is focused on being netcat for IPv6, but misses a bit of functionality right now.) Best greetings, Moritz Created attachment 60284 [details]
patch to fix service detection of names with dashes
Fixed in 1.10-15, thanks! There's still an obvious blooper ;-) in my code. And I found it _without_ doing any testing, just by reading my code in the new RPM. :-( (argv[optind][0] > '0') && (argv[optind][0] < '9') should be (argv[optind][0] >= '0') && (argv[optind][0] =< '9') (This time, I also tested it to be wrong, just to go sure.) Pretty obvious. Really sorry for breaking things, Moritz :-( Created attachment 66505 [details]
new patch to fix service detection of names with dashes
Added, thanks. |