The symptom for this one is randomly getting lines split before the last
word, even if there's no need for splitting. Also, this function is only
reached if recode is on, and iconv failed (for example, due to an
incorrect source charset). Thanks to vague for finding this and
providing valgrind logs.
The loop that looks for spaces tried to read backwards from the end of
the current line, with the end being determined by len. Assuming
strsplit_len() with len=400, this meant accessing str[399] in the first
iteration. For strings that don't need splitting, this means an invalid
read always.
If that invalid read happens to hit garbage that has a space character,
(len - offset) points after the end of string, which isn't a problem for
g_strndup() since it stops at the first null, and no splitting happens.
If the garbage doesn't have any spaces, it splits by the last word.
This commit avoids that loop entirely if (remaining_len > len). It also
changes the way it iterates over the string to be much less confusing.
Turns out it was fixing the wrong string, and trying to do
atoi("RECON-1") instead of atoi("1").
"/reconnect 1" worked, but "/reconnect RECON-1" gave that confusing
error message.
Given a big enough write_buffer_size and a long enough
write_buffer_timeout it might be possible to show the user an incomplete
or empty awaylog.
Patch by: Petteri Aimonen
term_addstr() had a long-standing fixme that suggested it didn't
take into account the string encoding when calculating the string
length.
The BIG5 code path is untested.
Both cases were off-by-one mistakes erring on the side of being too
conservative. This fixes these two harmless issues:
- For a single empty paste, it required another keystroke before
processing it
- For a sequence of themcase, a single '~' was left in the input
This actually workarounds a bug with the "st" terminal, for which i've
already submitted a patch, but irssi needs to be able to handle it
decently too.
The g_strcmp0 fallback in particular was broken since it was used in a
few places as a GCompareFunc, and macros don't work that way.
Yes, that one was my fault, but nobody complained :D
Turns out event_names_list() in irc-nicklist.c already handles this.
event_who() just ignores it, which is probably a good idea since some of
the irc servers I tested this with have a bug that results in sending
multiple prefixes in the NAMES reply but not in the WHO one (they were
forks of ircd-hybrid before 7.3.0)
And NAMES always happens, anyway. WHO is omitted sometimes for huge
channels.
The return value is a char*, and here it was false which is 0 which is
more or less the same as null.
That could have been a crash somewhere, the functions that call this
don't expect null ever.
Just passing the full target to the "message irc op_public" signal
handler and letting it do the cleanup.
The fe_channel_skip_prefix() call in event_privmsg() is kept because
recode_in() needs a real channel name, but
There was similar code in sig_message_own_wall(), but that one is
correct - the /wall command always sends NOTICE @#chan, so I added a
comment down there to make it clear.
Fixes FS#817 - "SegFault when executing bind command", which provides
the test case "/bind cleft key meta", which is stupid but now it doesn't
break things.
The limit of 100 is arbitrary, it means roughly 140 stack frames total.
The flyspray ticket mentions it crashes at 512, in my system it goes all
the way to 149677 stack frames.
http://bugs.irssi.org/index.php?do=details&task_id=817
http://bugs.irssi.org/index.php?do=details&task_id=905
Not using the patch from that ticket, the issue turned out to be that
(dest - last_lf_pos) returned number of unichr, not bytes, so that's 4
times less than what the size parameter of memmove() should be.
We disable the ICRNL flag to make Enter independent from ^J from the
keybinding point of view since the former will now send ^M, leaving the
user free to remap ^J without trapping itself into the irssi session
because of a broken Enter key.
Also disable the software flow control because we don't expect anyone to
run irssi over a serial console; we gain some more freedom by having ^Q
and ^S freely mappable by the user.
Replace G_SOURCE_REMOVE with FALSE for the compatibility sake.
Zero the timeout id after g_source_remove and when exipred.
Save the sasl_* options in sig_chatnet_saved().
The only supported methods are PLAIN and EXTERNAL, the latter is untested as of
now.
The code gets the values from the keys named sasl_{mechanism,username,password}
specified for each chatnet.
Enter the "application" mode when setting up the terminal, this improves the
compatiblity with the standards; as a side effect now DEL key works ootb when
irssi is run in the suckless's st terminal.
Clean up the vector resulting from g_strsplit before
returning from expando_hostname(). Also, use g_strdup()
instead of g_strconcat() to return the pointer to hostname.
When changing the value of irssiproxy_ports to use a different network
name in a port that was already bound (so like changing from asd=6667 to
sdf=6667) it would throw "address already in use".
This fixes it by delaying the add_listen() calls after all the
remove_listen() were called.
The function now skips all the leading characters that are in the STATUSMSG. If
the server didn't send the STATUSMSG option then it's assumed to be "@+" for
compatibility with bahamut 2.4 (sic).
I wrote some tests to compare the behavior but I don't know where to put
them, so i'm including them here:
assert(g_strcmp0("a", "b") == -1);
assert(g_strcmp0(NULL, "a") == -1);
assert(g_strcmp0("a", NULL) == 1);
assert(g_strcmp0("b", "a") == 1);
assert(g_strcmp0("a", "a") == 0);
assert(g_strcmp0(NULL, NULL) == 0);
Change "proxy client connected" to "proxy client connecting" to avoid being confused by clients that have connected but not necessarily authenticated. Emit "proxy client connected" once authenticated, keeping the name for backwards compatibility.
We add some additional checks into the config parser's
node_section_index, node_traverse and node_set_str functions. In
particular, we check if the requested node is of scalar or complex type
and whether this matches the value found in the config. If it does not
match, then a warning is issued appropriately and the config is
corrected.
By temporarily raising the fatal log level to critical during irssi
start-up, we make it fail when the config file is broken. This is then
re-set so that /reload of a broken config file will not crash irssi and
just report the errors and gracefully continue instead.
The change introduced in #191 will crash irssi immediately if you
accidentally try to /reload certain broken config files. It is enough to
warn the user in this case, so we turn g_error into g_critical.
this adds the CONFIG_REC * to the config_node_section and
config_node_section_index APIs as they will require access to the config
cache later on to make the config parser more robust.
sed -i 's/hv_store/(void) &/'
This only results in a warning in older gcc versions, but that includes
the one used in the Travis CI environment by default
Fixes issue #187. It's a bit annoying this can't do anything other than
exit, however as there's no schema for the config it's only possible to
validate on use. This level of config can't be accessed from Perl so a
script can't cause Irssi to die (via this method at least).
Before this, doing "TERM=vt100 irssi" showed all text as bold and
blinking because of a failed check of window->term->TI_colors that
was doing (value & 8) and not expecting a value of 0.
The changed lines themselves look a bit weird, but they make more sense
in the context of the original commit, 96a292d4.
Original patch by hondza <sedaj2@gmail.com>, from FS#833. I applied
several needed style changes, and rebased to current HEAD.
This implements the IRCv3.2 self-message extension partially (we can't
announce its support through CAP yet). This is also the format used by
the 'privmsg' znc module, and is already implemented by several other
clients.
At some point in the past few years, Flyspray changed its URL scheme from id=nnn to task_id=nnn, which broke some old comments in the source. Update those comments to URLs that still work.
Try to split long lines on spaces to avoid words being splitted. This
can be turned off with the option `split_line_on_space'. The code
assumes that the terminal encoding has ASCII spaces.
The userhost Irssi uses for line splitting can in some cases be wrong,
for instance when a proxy is used or when a server cloaks the hostname
without telling the client. Now Irssi always assumes the userhost is of
maximum length. 10 for username (common value) and 63 for hostname (in
RFC 2812).
With many ignores (a few thousand) /reload could take so long that connections
were dropped. The problem is that nickmatch_rebuild() was being called for
every ignore. The easy solution is to only call it once at the end.
this fixes a crash due to illegal memory access that can occur if
something is printed to the screen on the "terminal resized"
handler. It is not clear to me whether this race condition can be
triggered by external incoming messages, but it might be better safe
than sorry.
Fixes FS#721
This makes Ctrl+^ and ^ bindable again as different keys. We do this
by escaping single `^` as `^-`, which is not a valid control character
(unlike `^^`)
The original approach suggested in FS#721 is insufficient, it will
break bindings such as `meta-^` because Irssi is convinced that `^`
introduces a Control-key ("key combo") so it is waiting for what may
follow.
while the last patch did stop /path/.xxx from turning italic, it also
stopped any other /emphasis/ from becoming italic. correct this by
testing for ispunct, so spaces are valid italic terminators
the colour 0 was broken by the extended colours patch because it needs
an explicit bit check (lower bits will be false since it is 0)
Thanks to lhynes for the report
Fixes Github issue #97https://github.com/irssi/irssi/issues/97
Fix proposed by ailin-nemui, built and tested on Debian Jessie using
0.8.15 source, tested by GeertHauwaerts as well.
It's tricky to make the banner show first in all cases and it's unlikely
to be seen if someone is connecting to a server already, so just don't
show it.