Bug 1507944 - afpcmd may crash on long options parsing
Summary: afpcmd may crash on long options parsing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: afpfs-ng
Version: epel7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michal Ambroz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-31 14:24 UTC by Petr Benes
Modified: 2021-05-12 05:50 UTC (History)
1 user (show)

Fixed In Version: afpfs-ng-0.8.1-35.fc33 afpfs-ng-0.8.1-35.fc34 afpfs-ng-0.8.1-35.el7 afpfs-ng-0.8.1-35.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-05 00:53:45 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Petr Benes 2017-10-31 14:24:02 UTC
Description of problem:
afpcmd crashes

# afpcmd --help
Segmentation fault (core dumped)

Version-Release number of selected component (if applicable):

afpfs-ng-0.8.1-14


How reproducible:

If it happens that some non-zero data is placed at certain memory location during the compilation then 100%.


(gdb) bt
#0  0x00007f80456d05a8 in __strncmp_sse2 () from /lib64/libc.so.6
#1  0x00007f8045724d6d in _getopt_internal_r () from /lib64/libc.so.6
#2  0x00007f8045725c8b in _getopt_internal () from /lib64/libc.so.6
#3  0x00007f8045725d13 in getopt_long () from /lib64/libc.so.6
#4  0x0000000000402451 in main ()

The main function in cmdline_main.c contains the following definition of the long_options array:

struct option long_options[] = {
        {"recursive",1,0,'r'},
};

The manpage for getopt_long says the following about option structure:
The last element of the array has to be filled with zeros.

The correct definition is as follows:

struct option long_options[] = {
        {"recursive",1,0,'r'},
        {NULL,0,NULL,0}
};

With this fix, the problem disappears.

Comment 1 Fedora Admin XMLRPC Client 2020-04-06 16:45:30 UTC
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.

Comment 2 Fedora Admin XMLRPC Client 2020-04-22 16:36:42 UTC
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.

Comment 3 Fedora Update System 2021-04-26 22:09:13 UTC
FEDORA-EPEL-2021-a7cac9b814 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-a7cac9b814

Comment 4 Fedora Update System 2021-04-26 22:09:47 UTC
FEDORA-2021-e5a17b617c has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e5a17b617c

Comment 5 Fedora Update System 2021-04-26 22:10:31 UTC
FEDORA-2021-e20e9f81e4 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e20e9f81e4

Comment 6 Fedora Update System 2021-04-26 22:11:11 UTC
FEDORA-EPEL-2021-0fab0cd8cf has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-0fab0cd8cf

Comment 7 Fedora Update System 2021-04-27 01:23:24 UTC
FEDORA-2021-e5a17b617c has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-e5a17b617c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-e5a17b617c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2021-04-27 01:27:03 UTC
FEDORA-2021-e20e9f81e4 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-e20e9f81e4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-e20e9f81e4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2021-04-27 01:29:01 UTC
FEDORA-EPEL-2021-0fab0cd8cf has been pushed to the Fedora EPEL 7 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-0fab0cd8cf

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2021-04-27 01:36:33 UTC
FEDORA-EPEL-2021-a7cac9b814 has been pushed to the Fedora EPEL 8 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-a7cac9b814

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2021-05-05 00:53:45 UTC
FEDORA-2021-e20e9f81e4 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2021-05-05 01:21:24 UTC
FEDORA-2021-e5a17b617c has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2021-05-12 05:20:35 UTC
FEDORA-EPEL-2021-0fab0cd8cf has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2021-05-12 05:50:48 UTC
FEDORA-EPEL-2021-a7cac9b814 has been pushed to the Fedora EPEL 8 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.