Skip to content

Client Segfaults if topic contains a percent sign #760

Closed
@clesmian

Description

@clesmian

🐞 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🪲 bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions