[GH-ISSUE #760] Client Segfaults if topic contains a percent sign #547

Closed
opened 2026-05-07 00:25:20 +02:00 by BreizhHardware · 1 comment

Originally created by @clesmian on GitHub (Jun 1, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/760

🐞 Describe the bug
When the topic used to publish a message contains a '%' character, the client segfaults.

💻 Components impacted
ntfy 2.5.0 (df8b18b), runtime go1.19.9, built at 2023-05-18T18:01:45Z
Ubuntu 20.04 LTS amd64

💡 Screenshots and/or logs
Command: ntfy pub %

Output:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x8bf904]

goroutine 1 [running]:
heckel.io/ntfy/client.(*Client).PublishReader(0xc00065f560?, {0x7ffdcdc98246?, 0x8?}, {0x2600da0, 0xc0005e72e0}, {0x0, 0x0, 0xc00065f668?})
        /home/runner/work/ntfy/ntfy/client/client.go:106 +0x244
heckel.io/ntfy/cmd.execPublish(0xc0000b3dc0)
        /home/runner/work/ntfy/ntfy/cmd/publish.go:216 +0x1b1f
github.com/urfave/cli/v2.(*Command).Run(0x2c50960, 0xc0000b3dc0, {0xc00042e960, 0x2, 0x2})
        /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:274 +0xa42
github.com/urfave/cli/v2.(*Command).Run(0xc0005baf20, 0xc0000b3940, {0xc00011a150, 0x3, 0x3})
        /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:267 +0xc97
github.com/urfave/cli/v2.(*App).RunContext(0xc00047a000, {0x2607d28?, 0xc000128010}, {0xc00011a150, 0x3, 0x3})
        /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:332 +0x616
github.com/urfave/cli/v2.(*App).Run(...)
        /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:309
main.main()
        /home/runner/work/ntfy/ntfy/main.go:32 +0x333

🔮 Additional context
This does not seem to affect the server in any way

Originally created by @clesmian on GitHub (Jun 1, 2023). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/760 :lady_beetle: **Describe the bug** When the topic used to publish a message contains a '%' character, the client segfaults. :computer: **Components impacted** ntfy 2.5.0 (df8b18b), runtime go1.19.9, built at 2023-05-18T18:01:45Z Ubuntu 20.04 LTS amd64 :bulb: **Screenshots and/or logs** Command: `ntfy pub %` Output: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x8bf904] goroutine 1 [running]: heckel.io/ntfy/client.(*Client).PublishReader(0xc00065f560?, {0x7ffdcdc98246?, 0x8?}, {0x2600da0, 0xc0005e72e0}, {0x0, 0x0, 0xc00065f668?}) /home/runner/work/ntfy/ntfy/client/client.go:106 +0x244 heckel.io/ntfy/cmd.execPublish(0xc0000b3dc0) /home/runner/work/ntfy/ntfy/cmd/publish.go:216 +0x1b1f github.com/urfave/cli/v2.(*Command).Run(0x2c50960, 0xc0000b3dc0, {0xc00042e960, 0x2, 0x2}) /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:274 +0xa42 github.com/urfave/cli/v2.(*Command).Run(0xc0005baf20, 0xc0000b3940, {0xc00011a150, 0x3, 0x3}) /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/command.go:267 +0xc97 github.com/urfave/cli/v2.(*App).RunContext(0xc00047a000, {0x2607d28?, 0xc000128010}, {0xc00011a150, 0x3, 0x3}) /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:332 +0x616 github.com/urfave/cli/v2.(*App).Run(...) /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.3/app.go:309 main.main() /home/runner/work/ntfy/ntfy/main.go:32 +0x333 ``` :crystal_ball: **Additional context** This does not seem to affect the server in any way
BreizhHardware 2026-05-07 00:25:20 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@binwiederhier commented on GitHub (Jun 1, 2023):

Fixed in github.com/binwiederhier/ntfy@dc8932cd95, thanks for reporting!

<!-- gh-comment-id:1572553867 --> @binwiederhier commented on GitHub (Jun 1, 2023): Fixed in https://github.com/binwiederhier/ntfy/commit/dc8932cd953025708111c222d1c898202fbb1276, thanks for reporting!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#547
No description provided.