-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Bugfix/update win crypto apis #8047
Bugfix/update win crypto apis #8047
Conversation
65475fa
to
387d00b
Compare
387d00b
to
e95c560
Compare
e95c560
to
fd589be
Compare
ffe8841
to
26b12ed
Compare
Signed-off-by: Minos Galanakis <[email protected]>
2bb324a
to
59108d3
Compare
library/x509_crt.c
Outdated
* ANSI codepage. The input string is always described in BYTES and the | ||
* output length is described in WCHARs. | ||
*/ | ||
w_ret = MultiByteToWideChar(CP_ACP, 0, filename, length_as_int, szDir, |
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.
Re-reading this change, I'm not sure why we're bothering with the whole length_as_int
thing.
This would be a concern if len
wouldn't fit in an int
, but we actually know that len <= MAX_PATH - 3
, where MAX_PATH
is 260 or 32,767 (https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry)
So the cast in the (original) line 1559 is totally fine.
We also do a similar cast in (new) line 1588 - admittedly this is now "length remaining in buffer", which is a horrible re-use of variable with opposite meaning, but if we are happy with the cast at 1588 we should be happy with the cast at 1559.
(And fewer changes => better, IMO)
Supporting "Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions" would be a bigger, separate, set of changes
Signed-off-by: Minos Galanakis <[email protected]>
library/x509_crt.c
Outdated
@@ -61,6 +61,7 @@ | |||
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) | |||
#define WIN32_LEAN_AND_MEAN | |||
#include <windows.h> | |||
#include <intsafe.h> |
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.
do we need this change :) or can't we bear the thought of another update? :)
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.
Let's see if it clears CI, and I could try to push a last commit to remove that. Re reviewing an include could be simple.
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.
(note that the only functional changes to this file now are the #if changes)
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.
LGTM, thanks!
Signed-off-by: Minos Galanakis <[email protected]>
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.
LGTM - if you want to push a commit to remove the unnecessary include, then can quickly re-review
2108775
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.
LGTM
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.
LGTM
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.
LGTM - thanks
Description
This PR is a continuation of #730 and #1453 based on latest development. Resolves #1227
PR checklist
Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")