Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use static declaration for array sizes to uuid functions #395

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/sudo_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ sudo_dso_public void sudo_get_ttysize_v2(int fd, int *rowp, int *colp);
#define sudo_get_ttysize(_a, _b, _c) sudo_get_ttysize_v2((_a), (_b), (_c))

/* uuid.c */
sudo_dso_public void sudo_uuid_create_v1(unsigned char uuid_out[16]);
sudo_dso_public void sudo_uuid_create_v1(unsigned char uuid_out[restrict static 16]);
#define sudo_uuid_create(_a) sudo_uuid_create_v1((_a))
sudo_dso_public char *sudo_uuid_to_string_v1(const unsigned char uuid[restrict 16], char * restrict dst, size_t dstsiz);
sudo_dso_public char *sudo_uuid_to_string_v1(const unsigned char uuid[restrict static 16], char * restrict dst, size_t dstsiz);
#define sudo_uuid_to_string(_a, _b, _c) sudo_uuid_to_string_v1((_a), (_b), (_c))

#endif /* SUDO_UTIL_H */
4 changes: 2 additions & 2 deletions lib/util/uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct uuid {
* As per RFC 4122 section 4.4.
*/
void
sudo_uuid_create_v1(unsigned char uuid_out[16])
sudo_uuid_create_v1(unsigned char uuid_out[restrict static 16])
{
struct uuid uuid;

Expand All @@ -71,7 +71,7 @@ sudo_uuid_create_v1(unsigned char uuid_out[16])
* Format a uuid as a 36-byte string (plus one for the NUL).
*/
char *
sudo_uuid_to_string_v1(const unsigned char uuid[restrict 16], char * restrict dst, size_t dstsiz)
sudo_uuid_to_string_v1(const unsigned char uuid[restrict static 16], char * restrict dst, size_t dstsiz)
{
const char hex[] = "0123456789abcdef";
char *cp = dst;
Expand Down
Loading