{
struct smack_rule *rule = NULL;
- if (strnlen(subject, SMACK_LABEL_LEN + 1) > SMACK_LABEL_LEN ||
- strnlen(object, SMACK_LABEL_LEN + 1) > SMACK_LABEL_LEN)
+ if (smack_label_length(subject) < 0 ||
+ smack_label_length(object) < 0)
return -1;
rule = calloc(sizeof(struct smack_rule), 1);
{
struct smack_rule *rule = NULL;
- if (strnlen(subject, SMACK_LABEL_LEN + 1) > SMACK_LABEL_LEN ||
- strnlen(object, SMACK_LABEL_LEN + 1) > SMACK_LABEL_LEN)
+ if (smack_label_length(subject) < 0 ||
+ smack_label_length(object) < 0)
return -1;
rule = calloc(sizeof(struct smack_rule), 1);
label = strtok_r(buf, " \t\n", &ptr);
level = strtok_r(NULL, " \t\n", &ptr);
cat = strtok_r(NULL, " \t\n", &ptr);
- if (label == NULL || level == NULL ||
- strlen(label) > SMACK_LABEL_LEN)
+ if (smack_label_length(label) < 0 || level == NULL)
goto err_out;
strcpy(mapping->label, label);
int fd;
int ret;
- len = strnlen(label, SMACK_LABEL_LEN + 1);
- if (len > SMACK_LABEL_LEN)
+ len = smack_label_length(label);
+ if (len < 0)
return -1;
fd = open(SELF_LABEL_FILE, O_WRONLY);
int len;
char path[PATH_MAX];
- len = strnlen(subject, SMACK_LABEL_LEN + 1);
- if (len > SMACK_LABEL_LEN)
+ len = smack_label_length(subject);
+ if (len < 0)
return -1;
snprintf(path, sizeof path, "%s/revoke-subject", smackfs_mnt);