mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-27 02:02:26 +00:00
When loading a string setting, expect in the same form we would have
saved (raw text rather than Pascal string). [originally from svn r2314]
This commit is contained in:
parent
5b4947e590
commit
c6bbb682a3
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macstore.c,v 1.1 2002/11/19 02:13:46 ben Exp $ */
|
/* $Id: macstore.c,v 1.2 2002/12/12 23:55:51 ben Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* macstore.c: Macintosh-specific impementation of the interface
|
* macstore.c: Macintosh-specific impementation of the interface
|
||||||
@ -222,6 +222,7 @@ char *read_setting_s(void *handle, char *key, char *buffer, int buflen) {
|
|||||||
int fd;
|
int fd;
|
||||||
Handle h;
|
Handle h;
|
||||||
OSErr error;
|
OSErr error;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
if (handle == NULL) goto out;
|
if (handle == NULL) goto out;
|
||||||
fd = *(int *)handle;
|
fd = *(int *)handle;
|
||||||
@ -230,8 +231,11 @@ char *read_setting_s(void *handle, char *key, char *buffer, int buflen) {
|
|||||||
h = get1namedresource(FOUR_CHAR_CODE('TEXT'), key);
|
h = get1namedresource(FOUR_CHAR_CODE('TEXT'), key);
|
||||||
if (h == NULL) goto out;
|
if (h == NULL) goto out;
|
||||||
|
|
||||||
if (GetHandleSize(h) > buflen) goto out;
|
len = GetHandleSize(h);
|
||||||
p2cstrcpy(buffer, (StringPtr)*h);
|
if (len + 1 > buflen) goto out;
|
||||||
|
memcpy(buffer, *h, len);
|
||||||
|
buffer[len] = '\0';
|
||||||
|
|
||||||
ReleaseResource(h);
|
ReleaseResource(h);
|
||||||
if (ResError() != noErr) goto out;
|
if (ResError() != noErr) goto out;
|
||||||
return buffer;
|
return buffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user