sonyxperiadev / vendor-qcom-opensource-media

2 stars 8 forks source link

[LA.UM.8.1.r1] mm-video-v4l2: venc: Fix the length passed to strncmp #4

Closed pablomh closed 3 years ago

pablomh commented 4 years ago

Obviously the length of "sm6125" is "6" and not "7". Fix the copy/paste error.

Signed-off-by: Pablo Mendez Hernandez pablomh@gmail.com

MarijnS95 commented 4 years ago

Are you sure that isn't intended to check the null terminator, and trinket should be 8 instead?

(Not that it really matters, we don't expect any trailing characters)

EDIT: To be extra safe you might want to change these to sizeof("trinket") and sizeof("sm6125") (hint, they return 8 and 7 respectively) :wink:

pablomh commented 4 years ago

I'd rather leave the diff as is because:

a) It's the idiom used along the tree. b) I'm not sure that property_get does NULL-terminate the result, so I'd be more inclined to use strlen than sizeof.

MarijnS95 commented 4 years ago

I'd rather leave the diff as is because:

a) It's the idiom used along the tree.

Fine I guess; you introduced the piece of code so it's not unnecessarily introducing a diff on top of upstream code.

b) I'm not sure that property_get does NULL-terminate the result

It sure does, that's the "contract" of C strings! Otherwise functions like strlen or printf with %s will read out of bounds because it looks for the NULL character.

so I'd be more inclined to use strlen than sizeof.

So 6 it is.

pablomh commented 3 years ago

@jerpelea, any opinion?