Entering a long, invalid command to the terminal freezes the system
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
command-not-found (Ubuntu) |
Fix Released
|
High
|
Unassigned |
Bug Description
If I enter an invalid command that is a few thousand characters long it goes to the command-not-found program, and it starts to look for it in the repositories. This takes up a lot of RAM, and the whole system freezes.
By default, /usr/lib/
if len(args) == 1:
cnf = CommandNotFound
if not cnf.advise(args[0], options.
Adding a simple length check is enough to completely solve this problem.
if len(args) == 1:
# Fix crashing with long commands
if len(args[0]) > 50:
else:
cnf = CommandNotFound
if not cnf.advise(args[0], options.
I'm having this issue in Ubuntu 14.04.04 with command-not-found 0.3ubuntu12, but the same code is in 16.10's packages.
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: command-not-found 0.3ubuntu12 [modified: usr/lib/
ProcVersionSign
Uname: Linux 4.2.0-42-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.21
Architecture: amd64
CurrentDesktop: MATE
Date: Fri Jul 22 19:12:59 2016
PackageArchitec
SourcePackage: command-not-found
UpgradeStatus: No upgrade log present (probably fresh install)
Changed in command-not-found (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → High |
This bug was fixed in the package command-not-found - 0.3ubuntu18. 04.0~pre3
--------------- 04.0~pre3) bionic; urgency=medium
command-not-found (0.3ubuntu18.
* CommandNotFound /CommandNotFoun d.py:
- limit input to 256 chars to avoid DoS (LP: #1605732)
- add support for suggesting commands snap from snaps
(needs snapd 2.31+ to work)
- add "snapd" to suggests
-- Michael Vogt <email address hidden> Thu, 15 Feb 2018 09:15:40 +0100