diff options
| author | jsing <> | 2022-11-09 19:05:42 +0000 |
|---|---|---|
| committer | jsing <> | 2022-11-09 19:05:42 +0000 |
| commit | 36c70da569fa5716068eea108d08b49d394e5ad6 (patch) | |
| tree | 23c330414fd9837d062e25c95354182834c197a6 /src | |
| parent | 044d4caaeb509d391d3759f42b99126ff90e4e09 (diff) | |
| download | openbsd-36c70da569fa5716068eea108d08b49d394e5ad6.tar.gz openbsd-36c70da569fa5716068eea108d08b49d394e5ad6.tar.bz2 openbsd-36c70da569fa5716068eea108d08b49d394e5ad6.zip | |
Revise CBS_strdup() documentation.
CBS_strdup() now internally checks if the data contains NUL, failing if it
does.
Prompted by beck@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bytestring/bytestring.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/libcrypto/bytestring/bytestring.h b/src/lib/libcrypto/bytestring/bytestring.h index d8ef8ffdd2..d80e89c9a6 100644 --- a/src/lib/libcrypto/bytestring/bytestring.h +++ b/src/lib/libcrypto/bytestring/bytestring.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bytestring.h,v 1.3 2022/01/06 14:32:55 jsing Exp $ */ | 1 | /* $OpenBSD: bytestring.h,v 1.4 2022/11/09 19:05:42 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -80,11 +80,9 @@ int CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len); | |||
| 80 | /* | 80 | /* |
| 81 | * CBS_strdup copies the current contents of |cbs| into |*out_ptr| as a | 81 | * CBS_strdup copies the current contents of |cbs| into |*out_ptr| as a |
| 82 | * NUL-terminated C string. If |*out_ptr| is not NULL, the contents are freed | 82 | * NUL-terminated C string. If |*out_ptr| is not NULL, the contents are freed |
| 83 | * with free. It returns one on success and zero on allocation | 83 | * with free. It returns one on success and zero on failure. On success, |
| 84 | * failure. On success, |*out_ptr| should be freed with free. | 84 | * |*out_ptr| should be freed with free. If |cbs| contains NUL bytes, |
| 85 | * | 85 | * CBS_strdup will fail. |
| 86 | * NOTE: If |cbs| contains NUL bytes, the string will be truncated. Call | ||
| 87 | * |CBS_contains_zero_byte(cbs)| to check for NUL bytes. | ||
| 88 | */ | 86 | */ |
| 89 | int CBS_strdup(const CBS *cbs, char **out_ptr); | 87 | int CBS_strdup(const CBS *cbs, char **out_ptr); |
| 90 | 88 | ||
