From 2413c919e52f128e0a591b3a6aa5f418a9b3a9c1 Mon Sep 17 00:00:00 2001 From: jsing Date: Wed, 9 Nov 2022 19:05:42 +0000 Subject: [PATCH] Revise CBS_strdup() documentation. CBS_strdup() now internally checks if the data contains NUL, failing if it does. Prompted by beck@ --- lib/libcrypto/bytestring/bytestring.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/libcrypto/bytestring/bytestring.h b/lib/libcrypto/bytestring/bytestring.h index d8ef8ffdd23..d80e89c9a69 100644 --- a/lib/libcrypto/bytestring/bytestring.h +++ b/lib/libcrypto/bytestring/bytestring.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bytestring.h,v 1.3 2022/01/06 14:32:55 jsing Exp $ */ +/* $OpenBSD: bytestring.h,v 1.4 2022/11/09 19:05:42 jsing Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -80,11 +80,9 @@ int CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len); /* * CBS_strdup copies the current contents of |cbs| into |*out_ptr| as a * NUL-terminated C string. If |*out_ptr| is not NULL, the contents are freed - * with free. It returns one on success and zero on allocation - * failure. On success, |*out_ptr| should be freed with free. - * - * NOTE: If |cbs| contains NUL bytes, the string will be truncated. Call - * |CBS_contains_zero_byte(cbs)| to check for NUL bytes. + * with free. It returns one on success and zero on failure. On success, + * |*out_ptr| should be freed with free. If |cbs| contains NUL bytes, + * CBS_strdup will fail. */ int CBS_strdup(const CBS *cbs, char **out_ptr); -- 2.20.1