Skip to content

Array out of bounds error in draw.c #1935

@PossumTV

Description

@PossumTV

Did you read the guide?

Yes

What is the base version number of Motion being used?

4.7.x

What was the install method?

Built from source code

What is base architecture?

x86/x64

What is the distro being used?

Other

Disto version number

LFS 12.4

Camera/Sound type(s) being used?

v4l2 camera

Describe the issue/problem and steps to reproduce

There is an issue in the file draw.c.

The code starting at line 1115 of draw.c is:

    if ((pos_check <0) || (pos_check >127)) {
        pos_check = 45; /* Use a - for non ascii characters*/
    }

    char_ptr = char_arr_ptr[pos_check];

The 127 should be 126 because char_arr_ptr[] only goes 0-126, and if this code encounters an ASCII DEL character (127), it will overrun the array and segfault motion.

Now I have to find where my DEL character is coming from. :)

Relevant Motion log output (at log_level 8)

There is no relevant Motion log output. I could include gdb output if needed but I think the problem is fairly clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions