-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
lib/db: Fix copy into fixed size buffer issue in SQLite driver #4255
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned, in this case the G_strlcpy() and check nicely fits in one line, so no need to use a variable (len
).
I'm not sure whether this should result in warning or error, the result is in this case truncated. @wenzeslaus or @neteler what do you say?
Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
I'm going to try a take on this. Considering that this is library code, I would expect it to be more robust than a module or addon; Would that approach make sense? Is there a completely different point of view that I didn't consider? |
We should probably issue warning and |
The database library has its own set of functions handling errors. A more proper way to handle these failures is illustrated by: Lines 123 to 126 in adcdf28
The modules are (relatively) short lived and if there is a failure it may exit the process with e.g. G_fatal_error. A caller to the library, on the other hand, may wish to do some cleaning up or make an alternative approach in case of failure. |
…#4255) * drivers: copy into fixed size buffer issue * Requested changes * without variable * Update db/drivers/sqlite/db.c Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com> * Use Db statements --------- Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
This pull request resolves a buffer overflow issue detected by Coverity Scan (CID 1501211).
strcpy is replaced with G_strlcpy