Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #594] status.cgi segfault without hostgroup parameter on solaris 10 #293

Closed
icinga-migration opened this issue Jul 8, 2010 · 6 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/594

Created by mfriedrich on 2010-07-08 16:33:04 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2010-09-24 17:05:53 +00:00)
Target Version: 1.2 (Stable)
Last Update: 2014-12-08 09:50:24 +00:00 (in Redmine)

Icinga Version: 1.10.0
OS Version: any

http://tracker.nagios.org/view.php?id=120

Summary     0000120: status.cgi segfault without hostgroup parameter
Description     In trying to use both Andoid apps that are available, I've discovered by status.cgi will segfault if not given a hostgroup parameter

I can reproduce quite simply:
cd /usr/loca/nagios/sbin/
export REQUEST_METHOD='GET'
./status.cgi

Cache-Control: no-store
Pragma: no-cache
Refresh: 90
Last-Modified: Mon, 21 Dec 2009 01:06:01 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-type: text/html





Current Network Status










Current Network Status
Last Updated: Sun Dec 20 20:06:01 EST 2009

Updated every 90 seconds

Nagios® Core™ 3.2.0 - www.nagios.org

Logged in as ?





View History For all hosts

View Notifications For All Hosts

View Host Status Detail For All Hosts




Host Status Totals




Segmentation Fault


Additional Information  
Tags    No tags attached.
Nagios Version  3.2.0
OS  Solaris
OS Version  10 

Changesets

2010-09-24 15:57:40 +00:00 by mfriedrich 99c1ee9

classic ui: fix status.cgi segfault without hostgroup parameter on solaris 10 #594

defaults then to host_name, which is also NULL.
printf("%s", NULL) on Solaris is evil.

getenv also returns NULL if QUERY_STRING not set. this causes
strdup to segfault too - fixed.

fixes #594
refs #806
@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-07-30 12:16:33 +00:00

  • Project changed from Core, Classic UI, IDOUtils to 19
  • Category deleted Classic UI

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-08-30 08:34:05 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-09-24 14:27:31 +00:00

  • Target Version set to 1.2 (Stable)

    $ export REQUEST_METHOD=GET
    $ truss -f cgi/status.cgi

    Last Updated: Fri Sep 24 16:24:52 CEST 2010
    17690: write(1, " L a s t U p d a t e d".., 48) = 48
    Updated every 90 seconds [pause]
    17690: write(1, " U p d a t e d e v e r".., 174) = 174
    Icinga 1.0.3 - www.icinga.org
    17690: write(1, " I c i n g a 1 . 0 . 3".., 104) = 104
    (Credits to: Nagios® - www.nagios.org)Logged in as ?
    17690: write(1, " ( C r e d i t s t o :".., 142) = 142

    17690: write(1, " < / T D > < / T R >\n", 11) = 11

    17690: write(1, " < / T A B L E >\n", 9) = 9

    17690: write(1, " < / t d >\n", 6) = 6

    17690: write(1, " < t d a l i g n = c e".., 39) = 39
    Host Status Totals
    17690: write(1, " < D I V C L A S S = '".., 49) = 49

    17690: write(1, " < T A B L E B O R D E".., 45) = 45

    17690: write(1, " < T R > < T D >\n", 9) = 9

    17690: write(1, " < T A B L E B O R D E".., 36) = 36

    17690: write(1, " < T R >\n", 5) = 5
    17690: Incurred fault Fix comment typo in cgi/cmd.c #6, FLTBOUNDS %pc = 0xD0DC583C
    17690: siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000
    17690: Received signal [dev.icinga.com #28] Rename and repack of actual core components #11, SIGSEGV [default]
    17690: siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000

    export REQUEST_METHOD=GET ; /usr/local/bin/gdb /export/home/icinga/icinga-core/cgi/status.cgi

    GNU gdb 6.8
    Copyright (C) 2008 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i386-pc-solaris2.10"...
    (gdb) run
    Starting program: /export/home/icinga/icinga-core/cgi/status.cgi
    Cache-Control: no-store
    Pragma: no-cache
    Refresh: 90
    Last-Modified: Sun, 10 Dec 1944 22:09:42 GMT
    Expires: Thu, 01 Jan 1970 00:00:00 GMT
    Content-type: text/html

    Current Network Status

    Current Network Status
    Last Updated: Fri Sep 24 16:27:25 CEST 2010
    Updated every 90 seconds [pause]
    Icinga 1.0.3 - www.icinga.org
    (Credits to: Nagios® - www.nagios.org)Logged in as ?

    Host Status Totals

    Program received signal SIGSEGV, Segmentation fault.
    0xd0dc583c in strlen () from /lib/libc.so.1

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-09-24 15:25:16 +00:00

(gdb) bt

#0  0xd0dc583c in strlen () from /lib/libc.so.1
#1  0xd0e20326 in _ndoprnt () from /lib/libc.so.1
#2  0xd0e22fec in printf () from /lib/libc.so.1
#3  0x08058edd in show_host_status_totals () at status.c:1104
#4  0x080632a2 in main () at status.c:343
Breakpoint 4, show_host_status_totals () at status.c:1096 1096 printf("host=%s",url_encode(host_name)); (gdb) p host_name $2 = 0x0 (gdb) n 1104 printf("&style=hostdetail"); (gdb) n
Program received signal SIGSEGV, Segmentation fault.
0xd0dc583c in strlen () from /lib/libc.so.1

here we go again - printf("%s", NULL) in Solaris is not allowed. check #345

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-09-24 17:05:53 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-12-08 09:50:24 +00:00

  • Project changed from 19 to Core, Classic UI, IDOUtils
  • Category set to Classic UI
  • Icinga Version set to 1
  • OS Version set to any

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant