-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Vla/static buffer removal #2405
Conversation
Thank you. But since it's just local, IMO it's overkill to compute the length then alloc, you could just alloc 8192 directly (and it is freed immediately). |
Thought about it too. What about the length of additional args? Should I account for them too? |
This is more explicit. PR #2405 <#2405> Signed-off-by: Romain Vimont <[email protected]>
And increase the command buffer size. Refs #1358 <#1358 (comment)> PR #2405 <#2405> Signed-off-by: Romain Vimont <[email protected]>
Thank you very much. I made the following changes:
I pushed to branch Regards |
Seems fine, not entirely sure why len here Line 84 in b24be9e
scrcpy/app/src/sys/win/process.c Line 9 in b24be9e
since they're both being fed the same argv? |
@@ -32,6 +31,8 @@ | |||
|
|||
#endif | |||
|
|||
#define CMD_MAX 8192 |
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 CMD_MAX
limit in scrcpy is specific to Windows (on Linux, each argument is passed separately), so it should not be in the shared process.h
.
@@ -6,6 +6,11 @@ | |||
#include "util/log.h" | |||
#include "util/str_util.h" | |||
|
|||
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG) | |||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | |||
#endif |
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.
off-topic
switch (err) { | ||
case PROCESS_ERROR_GENERIC: | ||
argv_to_string(argv, buf, sizeof(buf)); | ||
argv_to_string(argv, buf, CMD_MAX); |
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 limit has no reason to equal CMD_MAX here (the string also contains other characters).
Since it's for an error message (and the argv_to_string()
message explicitly truncates the command, I think it is ok to limit to a smaller value (typically, the error is in argv[0]
due to SCRCPY_SERVER_PATH
anyway, that's the reason why I added the log).
Oh, sorry, my inline reviews were not committed on github (still pending). The reason is explained here: #2405 (comment) |
This is more explicit. PR #2405 <#2405> Signed-off-by: Romain Vimont <[email protected]>
And increase the command buffer size. Refs #1358 <#1358 (comment)> PR #2405 <#2405> Signed-off-by: Romain Vimont <[email protected]>
Merged. 👍 |
No description provided.