Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting a segfault form libpci #21

Closed
jnettlet opened this issue Nov 13, 2023 · 3 comments
Closed

Getting a segfault form libpci #21

jnettlet opened this issue Nov 13, 2023 · 3 comments

Comments

@jnettlet
Copy link

jnettlet commented Nov 13, 2023

I believe you sscanf matching implementation in get_device_name and populate_devices is slightly incorrect. Your format specifier matches everything up to the - character which leaves the separator as part of the domain integer. If the domain is zero this is most likely irrelevant since -0 should be overlooked. However for my configuration this was making the domain -4 which is obviously invalid. Instead I have changed the code as following to get things up and working.

@@ -649,7 +649,7 @@ static void populate_devices(obs_property_t *prop)
                char device[1024] = {};
                int domain, bus, dev, fun;
 
-               sscanf(list[i]->d_name, "%*[^-]%x:%x:%x.%x%*s", &domain, &bus,
+               sscanf(list[i]->d_name, "%*[^-]-%x:%x:%x.%x%*s", &domain, &bus,
                       &dev, &fun);
@fzwoch fzwoch closed this as completed in b4a12dd Nov 13, 2023
@fzwoch
Copy link
Owner

fzwoch commented Nov 13, 2023

Nice catch, thanks!

@jnettlet
Copy link
Author

jnettlet commented Nov 13, 2023 via email

@fzwoch
Copy link
Owner

fzwoch commented Nov 13, 2023

Ugh, didn't realize I had it twice because of the legacy encoders. Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants