Skip to content

Possible NULL pointer dereference in libraries/AP_HAL_F4Light/hardware/hal/timer.c #8641

@KimHyungSub

Description

@KimHyungSub

Issue details

At line 446 in ardupilot-Copter-3.6/libraries/AP_HAL_F4Light/hardware/hal/timer.c, dev can null pointer dereference.
Before dereference dev->type, it is better to check whether dev is null pointer or not.
---------- Original source code ----------

void timer_set_mode(const timer_dev *dev, timer_Channel channel, timer_mode mode) {
    assert_param(channel > 0 && channel <= 4);

    /* TODO decide about the basic timers */
    assert_param(dev->type != TIMER_BASIC);
    if (!dev || dev->type == TIMER_BASIC)
        return;
     ....
}

Version

ardupilot-Copter-3.6

Platform

[ V] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine

Airframe type

Hardware type

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions