mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
fix possible null dereference
This commit is contained in:
parent
82988d3e41
commit
637436628a
1 changed files with 10 additions and 8 deletions
|
@ -498,16 +498,18 @@ PW32CP const struct php_win32_cp *php_win32_cp_cli_do_setup(DWORD id)
|
|||
|
||||
PW32CP const struct php_win32_cp *php_win32_cp_cli_do_restore(DWORD id)
|
||||
{/*{{{*/
|
||||
if (!id && orig_cp) {
|
||||
id = orig_cp->id;
|
||||
BOOL cli_io_restored = TRUE;
|
||||
|
||||
if (orig_in_cp) {
|
||||
cli_io_restored = cli_io_restored && SetConsoleCP(orig_in_cp->id);
|
||||
}
|
||||
|
||||
if (SetConsoleCP(orig_in_cp->id) && SetConsoleOutputCP(orig_out_cp->id)) {
|
||||
if (orig_cp) {
|
||||
return orig_cp;
|
||||
} else {
|
||||
return php_win32_cp_set_by_id(id);
|
||||
}
|
||||
if (orig_out_cp) {
|
||||
cli_io_restored = cli_io_restored && SetConsoleOutputCP(orig_out_cp->id);
|
||||
}
|
||||
|
||||
if (cli_io_restored && id) {
|
||||
return php_win32_cp_set_by_id(id);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue