Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@waja
Copy link
Member

@waja waja commented Feb 15, 2021

As strcpy may overflow the resulting buffer:

flo@p5:~$ /tmp/f/usr/lib/nagios/plugins/check_pgsql -d "$(seq 1 10000)"
*** buffer overflow detected ***: terminated
Aborted

I would propose to change the code rather like this, using snprintf
which honors the buffers size and guarantees null termination.

…ination. (Closes: monitoring-plugins#1601)

As strcpy may overflow the resulting buffer:

flo@p5:~$ /tmp/f/usr/lib/nagios/plugins/check_pgsql -d "$(seq 1 10000)"
*** buffer overflow detected ***: terminated
Aborted

I would propose to change the code rather like this, using snprintf
which honors the buffers size and guarantees null termination.
@waja waja added this to the 2.3.1 milestone Feb 15, 2021
Copy link
Contributor

@sni sni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, looks fine

@waja waja merged commit 7ac706e into monitoring-plugins:master Apr 7, 2021
@waja waja deleted the debian_982847_2 branch April 7, 2021 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants