Closed pierky closed 6 years ago
It seems to me that sources are read into a fixed size char sources[]
. When populating the array only sizeof(sources)
items are copied over.
My suggestion for the resolution of this bug is to check for the size of the sources entry in the argv
array and carry over this information to bgpq_expander.c:771
where sources char[] is built.
On Tue, Jul 11, 2017 at 04:23:34PM +0000, Pier Carlo Chiodi wrote:
Hello,
I'm facing an issue when passing a source list longer than 124 chars; it seems the program hangs, both when the -S option or the IRRD_SOURCES env var are used.
Maybe something wrong happens here?
Indeed, snprintf at line 773 truncated sources list so final CR character was not included making IRRD think this request line is not complete yet. Fixed version pushed to github, can you check if it fixes issue for you too ?
PS: just a curiosity question: what is the reason of using that large source list ?
PPS: sorry for delay, just back from vacation.
125 chars, -S:
$ bgpq3 -d -S "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234_" -3 -j -f 1 -l asn_list AS3333 DEBUG: bgpq_expander.c:742 bgpq_expand Acquired sendbuf of 4608 bytes DEBUG: bgpq_expander.c:771 bgpqexpand Requesting sources !s1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234^C
125 chars, IRRD_SOURCES:
$ IRRDSOURCES="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234" bgpq3 -d -3 -j -f 1 -l asn_list AS3333 DEBUG: bgpq_expander.c:742 bgpq_expand Acquired sendbuf of 4608 bytes DEBUG: bgpq_expander.c:771 bgpqexpand Requesting sources !s1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234^C
124 chars, -S:
$ bgpq3 -d -S "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234" -3 -j -f 1 -l asn_list AS3333 DEBUG: bgpq_expander.c:742 bgpq_expand Acquired sendbuf of 4608 bytes DEBUG: bgpq_expander.c:771 bgpq_expand Requesting sources !s1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 DEBUG: bgpq_expander.c:775 bgpq_expand Got answer F source(s) unavailable ERROR:Invalid source(s) '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234': F source(s) unavailable
124 chars, IRRD_SOURCES:
$ IRRD_SOURCES="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234" bgpq3 -d -3 -j -f 1 -l asn_list AS3333 DEBUG: bgpq_expander.c:742 bgpq_expand Acquired sendbuf of 4608 bytes DEBUG: bgpq_expander.c:771 bgpq_expand Requesting sources !s1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 DEBUG: bgpq_expander.c:775 bgpq_expand Got answer F source(s) unavailable ERROR:Invalid source(s) '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234': F source(s) unavailable
Credits to @benerudolph and the other guys that participated in the Euro-IX route server workshop for helping me out to analyze this.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.*
Hello,
Fixed version pushed to github, can you check if it fixes issue for you too ?
it works, thanks.
PS: just a curiosity question: what is the reason of using that large source list ?
Maybe @benerudolph can answer your question. I just filed this issue after I analyzed what initially looked like a bug in ARouteServer that he reported to me.
Hello,
I'm facing an issue when passing a source list longer than 124 chars; it seems the program hangs, both when the
-S
option or theIRRD_SOURCES
env var are used.Maybe something wrong happens here?
125 chars,
-S
:125 chars,
IRRD_SOURCES
:124 chars,
-S
:124 chars,
IRRD_SOURCES
:Credits to @benerudolph and the other guys that participated in the Euro-IX route server workshop for helping me out to analyze this.