diff options
| author | 2011-03-31 11:43:39 +0200 | |
|---|---|---|
| committer | 2011-03-31 11:43:39 +0200 | |
| commit | c5fe346717a449a6bfcdbd7477724d95cdeb85d5 (patch) | |
| tree | b2a6c7cf3e8d6aa176962dd7726207e4ecaf81b1 | |
| parent | 430100a50a955fc574f26524ec784b7f39e310b6 (diff) | |
| download | libimobiledevice-c5fe346717a449a6bfcdbd7477724d95cdeb85d5.tar.gz libimobiledevice-c5fe346717a449a6bfcdbd7477724d95cdeb85d5.tar.bz2 | |
userpref: Fix a segfault that might occour if locally stored certs could not be read
userpref_get_file_contents() was stil attempting to set the data and size
properties on the passed gnutls_datum_t even if g_file_get_contents() failed.
This shoud fix a possible segfault in any code code using the pairing.
| -rw-r--r-- | src/userpref.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/userpref.c b/src/userpref.c index 6e62000..4aab67b 100644 --- a/src/userpref.c +++ b/src/userpref.c | |||
| @@ -328,8 +328,10 @@ static int userpref_get_file_contents(const char *file, gnutls_datum_t * data) | |||
| 328 | g_free(filepath); | 328 | g_free(filepath); |
| 329 | 329 | ||
| 330 | /* Add it to the gnutls_datnum_t structure */ | 330 | /* Add it to the gnutls_datnum_t structure */ |
| 331 | data->data = (uint8_t*) content; | 331 | if (success) { |
| 332 | data->size = size; | 332 | data->data = (uint8_t*) content; |
| 333 | data->size = size; | ||
| 334 | } | ||
| 333 | 335 | ||
| 334 | return success; | 336 | return success; |
| 335 | } | 337 | } |
