[PATCH v3 0/1] MR134: ntdll: Don't hard-code the battery and AC adapter names on Linux
Alexandre Julliard (@julliard)
wine at gitlab.winehq.org
Wed Jun 15 14:36:40 CDT 2022
Alexandre Julliard (@julliard) commented about dlls/ntdll/unix/system.c:
> return cmz;
> }
>
> -static const char * get_sys_str(const char *path, char *s)
> +static const char * get_sys_str(const char *dirname, const char *basename, char *s)
> {
> - FILE *f = fopen(path, "r");
> + char path[64];
> + FILE *f;
> const char *ret = NULL;
>
> - if (f)
> + if (snprintf(path, sizeof(path), "%s/%s", dirname, basename) < 0) return NULL;
snprintf doesn't return -1 on overflow (which is the only failure you care about here).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/134#note_2141
More information about the wine-devel
mailing list