Skip to content

Commit 82eac2b

Browse files
LumioseSilmillert
authored andcommitted
Restrict-qualify sudo_hexchar_v1
sudo_hexchar_v1 requires an array of at least size-2, and is not aliased.
1 parent 827fa8b commit 82eac2b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

include/sudo_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ sudo_dso_public int sudo_getgrouplist2_v1(const char *name, gid_t basegid, GETGR
195195
#define sudo_getgrouplist2(_a, _b, _c, _d) sudo_getgrouplist2_v1((_a), (_b), (_c), (_d))
196196

197197
/* hexchar.c */
198-
sudo_dso_public int sudo_hexchar_v1(const char *s);
198+
sudo_dso_public int sudo_hexchar_v1(const char s[restrict static 2]);
199199
#define sudo_hexchar(_a) sudo_hexchar_v1(_a)
200200

201201
/* key_val.c */

lib/util/hexchar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* Returns a value 0-255 on success or -1 for invalid input.
3333
*/
3434
int
35-
sudo_hexchar_v1(const char *s)
35+
sudo_hexchar_v1(const char s[restrict static 2])
3636
{
3737
unsigned char result[2];
3838
unsigned int i;

0 commit comments

Comments
 (0)