Skip to content

Commit 7c91113

Browse files
committed
Fix a crash bug on Windows (didn't strdup the userconfig value)
1 parent fa40ddc commit 7c91113

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ libcups v3.0rc3 (YYYY-MM-DD)
1111
credential removal as documented.
1212
- Updated the raster functions to report more issues via
1313
`cupsRasterGetErrorString`.
14+
- Fixed a crash bug on Windows.
1415

1516

1617
libcups v3.0rc2 (2024-10-15)

cups/globals.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ cups_globals_alloc(void)
159159
HKEY key; // Registry key
160160
DWORD size; // Size of string
161161
static char installdir[1024] = "", // Install directory
162-
userconfig[1024] = "", // User configuration directory
163162
sysconfig[1024] = ""; // Server configuration directory
163+
char userconfig[1024] = "", // User configuration directory
164164
#endif // _WIN32
165165

166166

@@ -245,7 +245,7 @@ cups_globals_alloc(void)
245245
DEBUG_printf("cups_globals_alloc: userconfig=\"%s\"", userconfig);
246246
}
247247

248-
cg->userconfig = userconfig;
248+
cg->userconfig = strdup(userconfig);
249249

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

0 commit comments

Comments
 (0)