Change in ...libosmocore[master]: fix: vty crash by logging to killed telnet session

neels gerrit-no-reply at
Tue Aug 27 15:40:57 UTC 2019

neels has posted comments on this change. ( )

Change subject: fix: vty crash by logging to killed telnet session

Patch Set 1:

Commit Message: 
PS1, Line 11: segfaults: the vty->obuf is already NULL.
> Why do we try to send a message to a killed session first of all? That seems to be the route of the  […]
I want to make sure that we cannot ever crash by writing to a NULL ofd. Whatever the reasons for the NULL ofd, and whatever the reasons for wanting to log to it.

Fixing the higher level fail would be: close down the logging target before taking down the ofd. I care about that only secondarily. This is only one cause for logging to NULL that we found now.

Fair enough, if we ensure closed telnets always close down log targets safely the issue would not exist, but I am not willing to verify that now. That is why I want these NULL checks at the buffer API level. It makes all other calling code bugs non-fatal in a trivial way, without the need to fully audit the ancient vty code.

Can we please get over this and not make a huge thing of it? 
PS1, Line 16: Also guard all buffer_*() functions against a NULL buffer argument, which
> this looks like a hack to fix other parts of the code which may be wrong, and looks like it should b […]
If the calling code paths are not trivially clear, it is good practise to guard against NULL pointers. Rather drop a log line than crashing the entire program. 
PS1, Line 20: Related: OS#4164
> This ticket doesn't look related to me.
this one is correct, the one in the comment has a typo 
File src/vty/vty.c: 
PS1, Line 266: 			 * of this same (killed) telnet session. See OS#4146. */
> OS#4146 (https://osmocom. […]
aha, the commit log has the correct one: #4164. Here there is a number swap. thx

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idca3f54dc986abf6784790c12e69e02bdf77cb41
Gerrit-Change-Number: 15265
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr at>
Gerrit-CC: pespin <pespin at>
Gerrit-Comment-Date: Tue, 27 Aug 2019 15:40:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin at>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list