Change in libosmocore[master]: vty: fix use-after-free and memleaks in is_cmd_ambiguous()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Jul 11 13:48:53 UTC 2018


Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/9939 )

Change subject: vty: fix use-after-free and memleaks in is_cmd_ambiguous()
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/9939/1/src/vty/command.c
File src/vty/command.c:

https://gerrit.osmocom.org/#/c/9939/1/src/vty/command.c@1322
PS1, Line 1322:           enum match_type min, bool recur)
> Agree.  […]
I started out trying to free when needed, but hell, it is so stupidly confusing (especially with that 'matched' variable being set in different places, each needing a decision whether the pointer is a char* to free or not to free) that I decided: to have any degree of readable code, just talloc and then free all of it at the end. I think a talloc ctx is a lean little tool that fits the task pretty nicely.

Refactor: how!? the design is so broken that there is no easy way to do it. We could always copy to 'matched', but we hardly ever have optional args and it feels dumb to copy all strings all the time (for string comparison!) just because of some rare corner case. The only other thing I can think of is to very early during string parsing get rid of those stupid square brackets and flip a flag that says 'optional'. But that would be a largeish refactoring of the vty code, and I'm having enough of large refactorings right now.

I desperately need this/a fix to get on with the endless osmo-bsc inter-bsc HO, I really think this fix is good enough, and I frankly feel like bikeshed syndrome here: the large important patch has seen review only by laforge, while this easy bit here gets all sorts of tangents... :P (sheesh, have I really written 3 paragraphs on this now!?)



-- 
To view, visit https://gerrit.osmocom.org/9939
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia71ba742108b5ff020997bfb612ad5eb30d04fcd
Gerrit-Change-Number: 9939
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-CC: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-CC: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Comment-Date: Wed, 11 Jul 2018 13:48:53 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180711/0a603e81/attachment.htm>


More information about the gerrit-log mailing list