-
Notifications
You must be signed in to change notification settings - Fork 292
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
Fix a potential memory leak in file transfer #126
Fix a potential memory leak in file transfer #126
Conversation
First, thanks for this of course, and this is just some spontaneous feedback (Note, I am not the dlt-daemon maintainer)
|
Hi @gunnarx, many thanks for your feedback!
|
@nordominus Thanks for your understanding. At first you might perhaps check the following...
Before I go on, let me make clear that the purpose is not to nitpick on what your company lawyers have surely put a lot of work into, but I don't think it is wise for any FOSS project to immediately accept this text into the commit message without first clarifying options. Ultimately, I believe that if every company start crafting their own arbitrary additions then there are various problems with that:
Now, I don't intend to go into all details here because it is not the time or the place, but here are some of the points that may need to be discussed and fully agreed upon first:
And please understand that I'm talking about having a conversation that is needed across all/many open-source projects here - it's not only a small personal view for one particular project only. I may be convinced differently later on, but as I said my feeling is that this policy would be largely untenable for open-source collaboration. |
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.
Normally each project under GENIVI GitHub is controlled by the maintainer and in my role as Development Lead for GENIVI Alliance, I usually do not interfere (too much).
But for this I would like to add a formal "Reject" vote at the moment, until we have fully sorted out the implication of introducing the extra text in the git commit message. Thanks to the contributor and everyone else for your understanding.
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.
The former implementation did cause memory leak, but not segfault. Is there any case with segfault?
src/system/dlt-system-filetransfer.c
Outdated
fdir = dirname(fdir);/*dirname overwrites its argument anyway */ | ||
char *src_copy = strndup(src, PATH_MAX); | ||
MALLOC_ASSERT(src_copy); | ||
char* fdir = dirname(src_copy);/*dirname overwrites its argument anyway, depending on argument the returned address might change */ |
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.
Please keep the line in 80 columns.
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.
Yes it is only a memory leak, which can happen.
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.
Please keep the line in 80 columns.
Mh, line 315 (not touched by me) is even longer. Shall I reformat them too?
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.
Please keep the line in 80 columns.
Mh, line 315 (not touched by me) is even longer. Shall I reformat them too?
Hum, that is also true. But reformatting them is too much and more than what the commit itself you fix, so please modify only your lines. I can do those kind of reformatting for all the files. Thanks for reminding me of this.
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.
Line changed
@nordominus Is there any update? |
Yes, we are working on it :) |
@nordominus @gunnarx Got it. Thanks for the update! |
@nordominus Thank you for your update. It's great to hear that. Hope to hear from you soon! |
@nordominus Do you have any update on your work? |
@ssugiura Yes, unfortunately it took longer as expected due to summer vacation time. But I start working on both of my PRs tomorrow and try to get everything fixed for another review Many thanks for your patience! |
@nordominus Great, thanks for your quick update. |
@nordominus Friendly reminder. |
971f2bf
to
ede4acb
Compare
@ssugiura Yes, unfortunately it took longer as expected due to various reasons. I've reworked the commit as you requested and also changed the commit message and pull request in accordance with my company's contribution guidelines. @gunnarx may you have also a look at it and provide some more feedback? Many thanks! |
@nordominus Thanks a lot for your continuous work! Current one looks much better. |
This potential memory leak in dlt-system-filetransfer.c can happen if only a filename is passed to dirname(). In the current implementation of dlt-daemon, this issue cannot happen. But in case of refactoring or different usage there is a chance that it can be triggered. See: https://linux.die.net/man/3/dirname Signed-off-by: Andreas Seidl <andreas.seidl@daimler.com>
Keep comments within 80 columns Signed-off-by: Andreas Seidl <andreas.seidl@daimler.com>
ede4acb
to
eabb3f1
Compare
This potential memory leak in dlt-system-filetransfer.c can happen if only a filename
is passed to dirname(). In the current implementation of dlt-daemon, this issue cannot happen.
But in case of refactoring or different usage there is a chance that it can be triggered.
See: https://linux.die.net/man/3/dirname
The program was tested solely for our own use cases, which might differ from yours.
Andreas Seidl andreas.seidl@daimler.com, Mercedes-Benz AG on behalf of MBition GmbH
https://github.com/Daimler/daimler-foss/blob/master/LEGAL_IMPRINT.md
Licensed under MPL-2.0