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

Security: Multiple possible Intiger Overflows in HopfieldOptions.cc #4

Open
Shinkurt opened this issue Apr 25, 2017 · 4 comments
Open

Comments

@Shinkurt
Copy link

opencog/examples/hopfield/HopfieldOptions.cc , uses and calls for atoi() multiple times (197, 200, 203, 204, 207...)

In the case of atoi, if the input recieved is not checked, the resulting number can exceed the expected range -- causing integer or stack overflows.

If source is untrusted (meaning recieved from user-input), check both minimum and maximum with INT_MAX and INT_MIN for ints, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended).

Using these to map variables while calling for atoi() would be nice

  • strtol() LONG_MIN LONG_MAX
  • strtoll() LLONG_MIN LLONG_MAX
  • strtoimax() INTMAX_MIN INTMAX_MAX
  • strtoq() LLONG_MIN LLONG_MAX
@linas
Copy link
Member

linas commented Apr 25, 2017

Its possible that there's a problem here, but the suggested fixes are incorrect. parameters like width and hieght probably need to be positive and less than 65K, instead of being less that LONG_MAX.

Can you submit a patch that fixes this?

@Shinkurt
Copy link
Author

Yes, good point -- I didn't realize that is what was going on. I can't write a patch right now -- on phone -- >.>

@ngeiswei
Copy link
Member

On phone? @Shinkurt just curious, what kinda phone + tool set are you using?

@linas
Copy link
Member

linas commented Jun 16, 2017

So, are these being fixed?

@linas linas transferred this issue from opencog/opencog Sep 14, 2019
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

3 participants