Skip to content

passing null values to upsc results in kernel segmentation fault #2052

@desertwitch

Description

@desertwitch

when bash scripting with upsc it could happen that null variables are passed to upsc by mistake, reproducible with the terminal command upsc $UPS@$HOST for example - which would result in: upsc @ when those variables are in fact not set and/or null.

upsc @ currently results in a kernel segmentation fault on latest master, see:

root@Tower:~# upsc $UPS@$HOST
Segmentation fault
Sep 14 20:06:27 Tower kernel: upsc[28685]: segfault at 8 ip 000014a0bbce4236 sp 00007ffd21f42468 error 4 in libc-2.37.so[14a0bbc58000+169000] likely on CPU 1 (core 1, socket 0)
Sep 14 20:06:27 Tower kernel: Code: 00 00 66 90 66 0f ef c0 66 0f ef c9 66 0f ef d2 66 0f ef db 48 89 f8 48 89 f9 48 81 e1 ff 0f 00 00 48 81 f9 cf 0f 00 00 77 6a <f3> 0f 6f 20 66 0f 74 e0 66 0f d7 d4 85 d2 74 04 0f bc c2 c3 48 83

is there a way to recover from such an (easy to happen) mistake better than with a segmentation fault - perhaps such a malformation in the arguments could be caught before it would throw the kernel in distress?

OS: Slackware 15.0, NUT compiled from master

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimpacts-release-2.7.4Issues reported against NUT release 2.7.4 (maybe vanilla or with minor packaging tweaks)impacts-release-2.8.0Issues reported against NUT release 2.8.0 (maybe vanilla or with minor packaging tweaks)portabilityWe want NUT to build and run everywhere possible

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions