Bug 1419716

Summary: Summary: modem-manager-gui segfaults in strftime(3)
Product: [Fedora] Fedora Reporter: Bruce Jerrick <bmj001>
Component: modem-manager-guiAssignee: Orphan Owner <extras-orphan>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 24CC: mario.blaettermann
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-08 19:38:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to avoid modem-manager-gui segfault in strftime(3). none

Description Bruce Jerrick 2017-02-06 20:40:22 UTC
Created attachment 1248190 [details]
Patch to avoid modem-manager-gui segfault in strftime(3).

Description of problem:
When processing the timestamp on received SMS messages, modem-manager-gui
will segfault in strftime(3) if the timestamp of the message is bogusly
large.

Version-Release number of selected component:
modem-manager-gui-0.0.18-3.fc24.src.rpm

How reproducible:
Always, but depends on the device type and perhaps on the carrier (given
  some of T-M*bile's bogosity, the latter is a distinct possibility).
I get it with a Sierra/Netgear AirCard 340U, using T-Mobile carrier:
    Sierra MBIM [1199:9051]
    Version:NTG9X15C_01.13.12.14 Port:cdc-wdm0 Type:GSM
And there will have to be received SMS messages on the device.
The source of the message doesn't seem to matter.
The segfault occurs after the device is connected (immediately if already
  connected).

Steps to Reproduce:
Start modem-manager-gui, preferably from a shell command line.

Actual results:
If started from a shell command line:
    Thread 1 "modem-manager-g" received signal SIGSEGV, Segmentation fault.
    0x00007ffff4fddcd1 in __strftime_internal () from /lib64/libc.so.6
    ...
If started from a desktop menu nothing visible happens.

Expected results:
GUI window appears.

Additional info:
Patch included as an attachment.  A bit of a hack, it just rejects timestamps
  beyond Dec 31 2099 23:59:59 UTC (arbitrarily chosen).
I have seen these timestamps:
    44780030771068
    414220674071332
    2570748802095564
    2648553994663636
    4636272817371940
    9223372036854775807		# note: 2^63-1 (i.e., -1 in signed long)
(The range of those would seem to preclude them being valid but in some
  other format.  I haven't seen any in Un*x epoch format.)

In an ideal world, strftime(3) wouldn't segfault from bad data (in the
  struct tm argument).

Comment 1 Bruce Jerrick 2017-02-06 22:46:20 UTC
I don't reproduce the problem on F25 (modem-manager-gui-0.0.18-3.fc24.x86_64;
  that's the latest available for F25 or F26 Rawhide).
So I would assume it's something in the libs it uses to pull the raw info
  off the device -- I may have some mixed versions of those.
So this can probably be considered closed -- my patch will be good enough
  for me.

Comment 2 Bruce Jerrick 2017-02-10 07:39:11 UTC
Well, today things are different -- modem-manager-gui-0.0.18-3.fc24.x86_64
does segfault on F25.  I have now idea why the change in behavior (but I've
noticed in the past that modem-manager-gui can be rather inconsistent).

Comment 3 Bruce Jerrick 2017-02-17 17:12:41 UTC
This change should be made to the patch attachment:
Instead of:
    if (timestamp > 4102444799 {    /* Dec 31 2099 23:59:59 UTC */
this is better:
    if (timestamp < 0 || timestamp > 4102444799 {	/* Dec 31 2099 23:59:59 UTC */
because I've seen bogus -1 timestamps.
Of course, that will reject all the SMS messages sent prior to 1970. :-)

Comment 4 Fedora Admin XMLRPC Client 2017-07-05 10:48:29 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora End Of Life 2017-07-26 00:14:58 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2017-08-08 19:38:18 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.