aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-07-31 14:00:44 +0200
committerRobin Jarry <robin@jarry.cc>2023-07-31 15:05:11 +0200
commitdc5c35758dca410350ff36f9bf5c9090236e6043 (patch)
tree8ed652223532fa9aa4d2b80f63b296f9d052f5c9 /worker
parent037ee1a6cfb35383f34b0fcc70dfc53f9463bd09 (diff)
downloadaerc-dc5c35758dca410350ff36f9bf5c9090236e6043.tar.gz
compose: fix panic when adding empty header with uppercase letters
Running `:header Hello` causes a panic: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa09328] goroutine 1 [running]: git.sr.ht/~rjarry/aerc/widgets.(*Composer).AddEditor git.sr.ht/~rjarry/aerc/widgets/compose.go:1302 git.sr.ht/~rjarry/aerc/commands/compose.Header.Execute git.sr.ht/~rjarry/aerc/commands/compose/header.go:83 git.sr.ht/~rjarry/aerc/commands.(*Commands).ExecuteCommand git.sr.ht/~rjarry/aerc/commands/commands.go:133 main.execCommand git.sr.ht/~rjarry/aerc/main.go:71 This is because addEditor() converts the header name to lowercase before updating the c.editors map. After this, c.editors[header] (with `header` containing uppercase letters) returns nil causes a nil pointer access. This is a side effect of splitting AddEditor into public and private functions. focusEditor also converts the argument to lowercase. Fix and simplify this. Only call focusEditor with whatever the user provided. Fixes: 11e5390fa0ac ("compose: implement embedded headers in editor") Reported-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'worker')
0 files changed, 0 insertions, 0 deletions