View Issue Details

IDProjectCategoryView StatusLast Update
0005746unrealircdpublic2020-08-29 14:49
ReporterKindOne Assigned Tosyzop  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.0.6 
Fixed in Version5.0.7-rc1 
Summary0005746: /mode #channel +l 2147483648 adds gibberish for the channel limit.
DescriptionThe IRC'd adds gibberish " -./,),(-*,( " for the +l limit if you use anything starting from 2^31 and above.

2^31 -1, this works and adds the number as the limit..
/mode #channel +l 2147483647

2^31, this gets gibberish.
/mode #channel +l 2147483648
Steps To Reproduce/mode #channel +l 2147483648
Additional InformationTested on UnrealIRCd's official network and SwiftIRC (UnrealIRCd-4.2.2)
TagsNo tags attached.
3rd party modules

Activities

syzop

2020-08-28 16:42

administrator   ~0021724

I can indeed reproduce, but ONLY with that number... 2147483648
Above or below it just returns a number (negative, sometimes, but.. a number anyway). Same around 2^32, still numbers.

Seems you found something special :D

KindOne

2020-08-28 17:40

reporter   ~0021725

Looks like I did report it wrong, I had tested with adding/subtracting numbers and got the results below.

After more testing on the UnrealIRCd network,

2^31
mode #test +l 2147483648
* KindOne sets mode: +l -./,),(-*,(

2^31 - 1
mode #test +l 2147483647
* KindOne sets mode: +l 2147483647

2^31 + 1
mode #test +l 2147483649
* KindOne sets mode: +l -2147483647

2^31 + 2^31
mode #test +l 4294967296
* KindOne sets mode: -l

2^31 + 2^31 - 1
mode #test +l 4294967295
* KindOne sets mode: +l -1

2^31 + 2^31 + 1
mode #test +l 4294967297
* KindOne sets mode: +l 1

syzop

2020-08-29 14:49

administrator   ~0021726

Thanks for the report. It was a bug in the ircsnprintf function for that particular number. I fixed that but also added a range limit for +l at the same time, something I have been considering for a while.
It is still possible to get some odd results if you use insane numbers, for example +l 4294967295 will become +l 1 because atoi() for that number will result a negative number and a negative becomes 1. But no more weird characters. I consider the bug sufficiently fixed, and an improvement overall. Thanks for the report!

commit 8bed1cb42e5f2859f77e3b242294887574374125 (HEAD -> unreal50, origin/unreal50)
Author: Bram Matthys <[email protected]>
Date: Sat Aug 29 14:31:22 2020 +0200

    Channel mode +l is now limited between 1 and 1 billion, so positive
    numbers only. This makes things more logical for end-users.
    This fixes https://bugs.unrealircd.org/view.php?id=5746,
    bug reported by KindOne.
    The same issue was also fixed by previous commit, but still:
    it is better to limit things to a narrower range, this so you
    don't get different behavior depending on the CPU a server uses.

commit 10ecbffcaa2050796b13df8cf20e45048e5a556a
Author: Bram Matthys <[email protected]>
Date: Sat Aug 29 14:13:58 2020 +0200

    Fix irc*printf handling of certain negative numbers

Issue History

Date Modified Username Field Change
2020-08-28 10:25 KindOne New Issue
2020-08-28 16:42 syzop Note Added: 0021724
2020-08-28 17:40 KindOne Note Added: 0021725
2020-08-29 14:49 syzop Assigned To => syzop
2020-08-29 14:49 syzop Status new => resolved
2020-08-29 14:49 syzop Resolution open => fixed
2020-08-29 14:49 syzop Fixed in Version => 5.0.7-rc1
2020-08-29 14:49 syzop Note Added: 0021726