Skip to content

Commit

Permalink
Fix a crash bug on Windows (didn't strdup the userconfig value)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Oct 21, 2024
1 parent fa40ddc commit 7c91113
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ libcups v3.0rc3 (YYYY-MM-DD)
credential removal as documented.
- Updated the raster functions to report more issues via
`cupsRasterGetErrorString`.
- Fixed a crash bug on Windows.


libcups v3.0rc2 (2024-10-15)
Expand Down
4 changes: 2 additions & 2 deletions cups/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ cups_globals_alloc(void)
HKEY key; // Registry key
DWORD size; // Size of string
static char installdir[1024] = "", // Install directory
userconfig[1024] = "", // User configuration directory
sysconfig[1024] = ""; // Server configuration directory
char userconfig[1024] = "", // User configuration directory
#endif // _WIN32


Expand Down Expand Up @@ -245,7 +245,7 @@ cups_globals_alloc(void)
DEBUG_printf("cups_globals_alloc: userconfig=\"%s\"", userconfig);
}

cg->userconfig = userconfig;
cg->userconfig = strdup(userconfig);

#else
const char *home = getenv("HOME"); // HOME environment variable
Expand Down

0 comments on commit 7c91113

Please sign in to comment.