summaryrefslogtreecommitdiff
path: root/usr/src/lib/libcmdutils/libcmdutils.h
diff options
context:
space:
mode:
authorJoshua M. Clulow <jmc@joyent.com>2014-12-19 14:03:07 -0800
committerRobert Mustacchi <rm@joyent.com>2014-12-23 14:52:48 -0800
commit196c7f05d2deba7404e90ad67f3861185c78ca2d (patch)
tree29ff7b2bd21041c7331063485095b6008b58ee10 /usr/src/lib/libcmdutils/libcmdutils.h
parentaa64fa16549f13233681f4b40e50fb5b1c18a97c (diff)
downloadillumos-joyent-196c7f05d2deba7404e90ad67f3861185c78ca2d.tar.gz
5480 CVE-2012-3165 mailx(1) buffer overflow vulnerability
Reviewed by: Dan McDonald <danmcd@omniti.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/lib/libcmdutils/libcmdutils.h')
-rw-r--r--usr/src/lib/libcmdutils/libcmdutils.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/usr/src/lib/libcmdutils/libcmdutils.h b/usr/src/lib/libcmdutils/libcmdutils.h
index c315e0fbef..a280751c27 100644
--- a/usr/src/lib/libcmdutils/libcmdutils.h
+++ b/usr/src/lib/libcmdutils/libcmdutils.h
@@ -25,6 +25,9 @@
/*
* Copyright (c) 2013 RackTop Systems.
*/
+/*
+ * Copyright 2014 Joyent, Inc.
+ */
/*
* Declarations for the functions in libcmdutils.
@@ -140,6 +143,46 @@ extern int findnextuid(uid_t, uid_t, uid_t *);
*/
extern int findnextgid(gid_t, gid_t, gid_t *);
+
+
+ /* dynamic string utilities */
+
+typedef struct custr custr_t;
+
+/*
+ * Allocate and free a "custr_t" dynamic string object. Returns 0 on success
+ * and -1 otherwise.
+ */
+extern int custr_alloc(custr_t **);
+extern void custr_free(custr_t *);
+
+/*
+ * Append a single character, or a NUL-terminated string of characters, to a
+ * dynamic string. Returns 0 on success and -1 otherwise. The dynamic string
+ * will be unmodified if the function returns -1.
+ */
+extern int custr_appendc(custr_t *, char);
+extern int custr_append(custr_t *, const char *);
+
+/*
+ * Determine the length in bytes, not including the NUL terminator, of the
+ * dynamic string.
+ */
+extern size_t custr_len(custr_t *);
+
+/*
+ * Clear the contents of a dynamic string. Does not free the underlying
+ * memory.
+ */
+extern void custr_reset(custr_t *);
+
+/*
+ * Retrieve a const pointer to a NUL-terminated string version of the contents
+ * of the dynamic string. Storage for this string should not be freed, and
+ * the pointer will be invalidated by any mutations to the dynamic string.
+ */
+extern const char *custr_cstr(custr_t *str);
+
#ifdef __cplusplus
}
#endif