mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-26 19:03:48 +01:00
Introduce gctl_get_paraml() which gets a parameter only if it has the
right length.
This commit is contained in:
parent
fb9483af54
commit
ca3d750e73
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113893
@ -268,6 +268,23 @@ gctl_get_param(struct gctl_req *req, const char *param, int *len)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
gctl_get_paraml(struct gctl_req *req, const char *param, int len)
|
||||
{
|
||||
int i;
|
||||
void *p;
|
||||
|
||||
p = gctl_get_param(req, param, &i);
|
||||
if (p == NULL)
|
||||
gctl_error(req, "Missing %s argument", param);
|
||||
else if (i != len) {
|
||||
g_free(p);
|
||||
p = NULL;
|
||||
gctl_error(req, "Wrong length %s argument", param);
|
||||
}
|
||||
return (p);
|
||||
}
|
||||
|
||||
static struct g_class*
|
||||
gctl_get_class(struct gctl_req *req)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user