idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
35,800 | char *choose_init(const char *rootfs)
{
char *retv = NULL;
const char *empty = "",
*tmp;
int ret, env_set = 0;
struct stat mystat;
if (!getenv("PATH")) {
if (setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 0))
SYSERROR("Failed to setenv");
env_set = 1;
}
retv = on_pat... | null | 0 | char *choose_init(const char *rootfs)
{
char *retv = NULL;
const char *empty = "",
*tmp;
int ret, env_set = 0;
struct stat mystat;
if (!getenv("PATH")) {
if (setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 0))
SYSERROR("Failed to setenv");
env_set = 1;
}
retv = on_pat... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,801 | int detect_ramfs_rootfs(void)
{
char buf[LINELEN], *p;
FILE *f;
int i;
char *p2;
f = fopen("/proc/self/mountinfo", "r");
if (!f)
return 0;
while (fgets(buf, LINELEN, f)) {
for (p = buf, i=0; p && i < 4; i++)
p = strchr(p+1, ' ');
if (!p)
continue;
p2 = strchr(p+1, ' ');
if (!p2)
continue;
*... | null | 0 | int detect_ramfs_rootfs(void)
{
char buf[LINELEN], *p;
FILE *f;
int i;
char *p2;
f = fopen("/proc/self/mountinfo", "r");
if (!f)
return 0;
while (fgets(buf, LINELEN, f)) {
for (p = buf, i=0; p && i < 4; i++)
p = strchr(p+1, ' ');
if (!p)
continue;
p2 = strchr(p+1, ' ');
if (!p2)
continue;
*... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,802 | int detect_shared_rootfs(void)
{
char buf[LINELEN], *p;
FILE *f;
int i;
char *p2;
f = fopen("/proc/self/mountinfo", "r");
if (!f)
return 0;
while (fgets(buf, LINELEN, f)) {
for (p = buf, i=0; p && i < 4; i++)
p = strchr(p+1, ' ');
if (!p)
continue;
p2 = strchr(p+1, ' ');
if (!p2)
continue;
... | null | 0 | int detect_shared_rootfs(void)
{
char buf[LINELEN], *p;
FILE *f;
int i;
char *p2;
f = fopen("/proc/self/mountinfo", "r");
if (!f)
return 0;
while (fgets(buf, LINELEN, f)) {
for (p = buf, i=0; p && i < 4; i++)
p = strchr(p+1, ' ');
if (!p)
continue;
p2 = strchr(p+1, ' ');
if (!p2)
continue;
... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,803 | bool dir_exists(const char *path)
{
struct stat sb;
int ret;
ret = stat(path, &sb);
if (ret < 0)
return false;
return S_ISDIR(sb.st_mode);
}
| null | 0 | bool dir_exists(const char *path)
{
struct stat sb;
int ret;
ret = stat(path, &sb);
if (ret < 0)
return false;
return S_ISDIR(sb.st_mode);
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,804 | bool file_exists(const char *f)
{
struct stat statbuf;
return stat(f, &statbuf) == 0;
}
| null | 0 | bool file_exists(const char *f)
{
struct stat statbuf;
return stat(f, &statbuf) == 0;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,805 | uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval)
{
unsigned char *bp;
for(bp = buf; bp < (unsigned char *)buf + len; bp++)
{
/* xor the bottom with the current octet */
hval ^= (uint64_t)*bp;
/* gcc optimised:
* multiply by the 64 bit FNV magic prime mod 2^64
*/
hval += (hval << 1) + (hval ... | null | 0 | uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval)
{
unsigned char *bp;
for(bp = buf; bp < (unsigned char *)buf + len; bp++)
{
/* xor the bottom with the current octet */
hval ^= (uint64_t)*bp;
/* gcc optimised:
* multiply by the 64 bit FNV magic prime mod 2^64
*/
hval += (hval << 1) + (hval ... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,806 | uid_t get_ns_uid(uid_t orig)
{
char *line = NULL;
size_t sz = 0;
uid_t nsid, hostid, range;
FILE *f = fopen("/proc/self/uid_map", "r");
if (!f)
return 0;
while (getline(&line, &sz, f) != -1) {
if (sscanf(line, "%u %u %u", &nsid, &hostid, &range) != 3)
continue;
if (hostid <= orig && hostid + range > ori... | null | 0 | uid_t get_ns_uid(uid_t orig)
{
char *line = NULL;
size_t sz = 0;
uid_t nsid, hostid, range;
FILE *f = fopen("/proc/self/uid_map", "r");
if (!f)
return 0;
while (getline(&line, &sz, f) != -1) {
if (sscanf(line, "%u %u %u", &nsid, &hostid, &range) != 3)
continue;
if (hostid <= orig && hostid + range > ori... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,807 | char *get_template_path(const char *t)
{
int ret, len;
char *tpath;
if (t[0] == '/' && access(t, X_OK) == 0) {
tpath = strdup(t);
return tpath;
}
len = strlen(LXCTEMPLATEDIR) + strlen(t) + strlen("/lxc-") + 1;
tpath = malloc(len);
if (!tpath)
return NULL;
ret = snprintf(tpath, len, "%s/lxc-%s", LXCTEMPL... | null | 0 | char *get_template_path(const char *t)
{
int ret, len;
char *tpath;
if (t[0] == '/' && access(t, X_OK) == 0) {
tpath = strdup(t);
return tpath;
}
len = strlen(LXCTEMPLATEDIR) + strlen(t) + strlen("/lxc-") + 1;
tpath = malloc(len);
if (!tpath)
return NULL;
ret = snprintf(tpath, len, "%s/lxc-%s", LXCTEMPL... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,808 | extern int get_u16(unsigned short *val, const char *arg, int base)
{
unsigned long res;
char *ptr;
if (!arg || !*arg)
return -1;
errno = 0;
res = strtoul(arg, &ptr, base);
if (!ptr || ptr == arg || *ptr || res > 0xFFFF || errno != 0)
return -1;
*val = res;
return 0;
}
| null | 0 | extern int get_u16(unsigned short *val, const char *arg, int base)
{
unsigned long res;
char *ptr;
if (!arg || !*arg)
return -1;
errno = 0;
res = strtoul(arg, &ptr, base);
if (!ptr || ptr == arg || *ptr || res > 0xFFFF || errno != 0)
return -1;
*val = res;
return 0;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,809 | static void gnutls_lxc_init(void)
{
gnutls_global_init();
}
| null | 0 | static void gnutls_lxc_init(void)
{
gnutls_global_init();
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,810 | static bool is_native_overlayfs(const char *path)
{
struct statfs sb;
if (statfs(path, &sb) < 0)
return false;
if (sb.f_type == OVERLAYFS_SUPER_MAGIC ||
sb.f_type == OVERLAY_SUPER_MAGIC)
return true;
return false;
}
| null | 0 | static bool is_native_overlayfs(const char *path)
{
struct statfs sb;
if (statfs(path, &sb) < 0)
return false;
if (sb.f_type == OVERLAYFS_SUPER_MAGIC ||
sb.f_type == OVERLAY_SUPER_MAGIC)
return true;
return false;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,811 | void **lxc_append_null_to_array(void **array, size_t count)
{
void **temp;
/* Append NULL to the array */
if (count) {
temp = realloc(array, (count + 1) * sizeof(*array));
if (!temp) {
int i;
for (i = 0; i < count; i++)
free(array[i]);
free(array);
return NULL;
}
array = temp;
array[count]... | null | 0 | void **lxc_append_null_to_array(void **array, size_t count)
{
void **temp;
/* Append NULL to the array */
if (count) {
temp = realloc(array, (count + 1) * sizeof(*array));
if (!temp) {
int i;
for (i = 0; i < count; i++)
free(array[i]);
free(array);
return NULL;
}
array = temp;
array[count]... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,812 | char *lxc_append_paths(const char *first, const char *second)
{
size_t len = strlen(first) + strlen(second) + 1;
const char *pattern = "%s%s";
char *result = NULL;
if (second[0] != '/') {
len += 1;
pattern = "%s/%s";
}
result = calloc(1, len);
if (!result)
return NULL;
snprintf(result, len, pattern, fi... | null | 0 | char *lxc_append_paths(const char *first, const char *second)
{
size_t len = strlen(first) + strlen(second) + 1;
const char *pattern = "%s%s";
char *result = NULL;
if (second[0] != '/') {
len += 1;
pattern = "%s/%s";
}
result = calloc(1, len);
if (!result)
return NULL;
snprintf(result, len, pattern, fi... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,813 | size_t lxc_array_len(void **array)
{
void **p;
size_t result = 0;
for (p = array; p && *p; p++)
result++;
return result;
}
| null | 0 | size_t lxc_array_len(void **array)
{
void **p;
size_t result = 0;
for (p = array; p && *p; p++)
result++;
return result;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,814 | void lxc_free_array(void **array, lxc_free_fn element_free_fn)
{
void **p;
for (p = array; p && *p; p++)
element_free_fn(*p);
free((void*)array);
}
| null | 0 | void lxc_free_array(void **array, lxc_free_fn element_free_fn)
{
void **p;
for (p = array; p && *p; p++)
element_free_fn(*p);
free((void*)array);
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,815 | int lxc_grow_array(void ***array, size_t* capacity, size_t new_size, size_t capacity_increment)
{
size_t new_capacity;
void **new_array;
/* first time around, catch some trivial mistakes of the user
* only initializing one of these */
if (!*array || !*capacity) {
*array = NULL;
*capacity = 0;
}
new_capaci... | null | 0 | int lxc_grow_array(void ***array, size_t* capacity, size_t new_size, size_t capacity_increment)
{
size_t new_capacity;
void **new_array;
/* first time around, catch some trivial mistakes of the user
* only initializing one of these */
if (!*array || !*capacity) {
*array = NULL;
*capacity = 0;
}
new_capaci... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,816 | char **lxc_normalize_path(const char *path)
{
char **components;
char **p;
size_t components_len = 0;
size_t pos = 0;
components = lxc_string_split(path, '/');
if (!components)
return NULL;
for (p = components; *p; p++)
components_len++;
/* resolve '.' and '..' */
for (pos = 0; pos < components_len; ) {
... | null | 0 | char **lxc_normalize_path(const char *path)
{
char **components;
char **p;
size_t components_len = 0;
size_t pos = 0;
components = lxc_string_split(path, '/');
if (!components)
return NULL;
for (p = components; *p; p++)
components_len++;
/* resolve '.' and '..' */
for (pos = 0; pos < components_len; ) {
... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,817 | extern int lxc_pclose(struct lxc_popen_FILE *fp)
{
FILE *f = NULL;
pid_t child_pid = 0;
int wstatus = 0;
pid_t wait_pid;
if (fp) {
f = fp->f;
child_pid = fp->child_pid;
/* free memory (we still need to close file stream) */
free(fp);
fp = NULL;
}
if (!f || fclose(f)) {
ERROR("fclose failure");
re... | null | 0 | extern int lxc_pclose(struct lxc_popen_FILE *fp)
{
FILE *f = NULL;
pid_t child_pid = 0;
int wstatus = 0;
pid_t wait_pid;
if (fp) {
f = fp->f;
child_pid = fp->child_pid;
/* free memory (we still need to close file stream) */
free(fp);
fp = NULL;
}
if (!f || fclose(f)) {
ERROR("fclose failure");
re... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,818 | int lxc_read_from_file(const char *filename, void* buf, size_t count)
{
int fd = -1, saved_errno;
ssize_t ret;
fd = open(filename, O_RDONLY | O_CLOEXEC);
if (fd < 0)
return -1;
if (!buf || !count) {
char buf2[100];
size_t count2 = 0;
while ((ret = read(fd, buf2, 100)) > 0)
count2 += ret;
if (ret >= ... | null | 0 | int lxc_read_from_file(const char *filename, void* buf, size_t count)
{
int fd = -1, saved_errno;
ssize_t ret;
fd = open(filename, O_RDONLY | O_CLOEXEC);
if (fd < 0)
return -1;
if (!buf || !count) {
char buf2[100];
size_t count2 = 0;
while ((ret = read(fd, buf2, 100)) > 0)
count2 += ret;
if (ret >= ... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,819 | ssize_t lxc_read_nointr(int fd, void* buf, size_t count)
{
ssize_t ret;
again:
ret = read(fd, buf, count);
if (ret < 0 && errno == EINTR)
goto again;
return ret;
}
| null | 0 | ssize_t lxc_read_nointr(int fd, void* buf, size_t count)
{
ssize_t ret;
again:
ret = read(fd, buf, count);
if (ret < 0 && errno == EINTR)
goto again;
return ret;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,820 | ssize_t lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf)
{
ssize_t ret;
ret = lxc_read_nointr(fd, buf, count);
if (ret <= 0)
return ret;
if ((size_t)ret != count)
return -1;
if (expected_buf && memcmp(buf, expected_buf, count) != 0) {
errno = EINVAL;
return -1;
}
return r... | null | 0 | ssize_t lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf)
{
ssize_t ret;
ret = lxc_read_nointr(fd, buf, count);
if (ret <= 0)
return ret;
if ((size_t)ret != count)
return -1;
if (expected_buf && memcmp(buf, expected_buf, count) != 0) {
errno = EINVAL;
return -1;
}
return r... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,821 | extern int lxc_rmdir_onedev(char *path, const char *exclude)
{
struct stat mystat;
bool onedev = true;
if (is_native_overlayfs(path)) {
onedev = false;
}
if (lstat(path, &mystat) < 0) {
if (errno == ENOENT)
return 0;
ERROR("%s: failed to stat %s", __func__, path);
return -1;
}
return _recursive_rmd... | null | 0 | extern int lxc_rmdir_onedev(char *path, const char *exclude)
{
struct stat mystat;
bool onedev = true;
if (is_native_overlayfs(path)) {
onedev = false;
}
if (lstat(path, &mystat) < 0) {
if (errno == ENOENT)
return 0;
ERROR("%s: failed to stat %s", __func__, path);
return -1;
}
return _recursive_rmd... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,822 | bool lxc_string_in_array(const char *needle, const char **haystack)
{
for (; haystack && *haystack; haystack++)
if (!strcmp(needle, *haystack))
return true;
return false;
}
| null | 0 | bool lxc_string_in_array(const char *needle, const char **haystack)
{
for (; haystack && *haystack; haystack++)
if (!strcmp(needle, *haystack))
return true;
return false;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,823 | bool lxc_string_in_list(const char *needle, const char *haystack, char _sep)
{
char *token, *str, *saveptr = NULL;
char sep[2] = { _sep, '\0' };
if (!haystack || !needle)
return 0;
str = alloca(strlen(haystack)+1);
strcpy(str, haystack);
for (; (token = strtok_r(str, sep, &saveptr)); str = NULL) {
if (strcm... | null | 0 | bool lxc_string_in_list(const char *needle, const char *haystack, char _sep)
{
char *token, *str, *saveptr = NULL;
char sep[2] = { _sep, '\0' };
if (!haystack || !needle)
return 0;
str = alloca(strlen(haystack)+1);
strcpy(str, haystack);
for (; (token = strtok_r(str, sep, &saveptr)); str = NULL) {
if (strcm... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,824 | char *lxc_string_join(const char *sep, const char **parts, bool use_as_prefix)
{
char *result;
char **p;
size_t sep_len = strlen(sep);
size_t result_len = use_as_prefix * sep_len;
/* calculate new string length */
for (p = (char **)parts; *p; p++)
result_len += (p > (char **)parts) * sep_len + strlen(*p);
re... | null | 0 | char *lxc_string_join(const char *sep, const char **parts, bool use_as_prefix)
{
char *result;
char **p;
size_t sep_len = strlen(sep);
size_t result_len = use_as_prefix * sep_len;
/* calculate new string length */
for (p = (char **)parts; *p; p++)
result_len += (p > (char **)parts) * sep_len + strlen(*p);
re... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,825 | char *lxc_string_replace(const char *needle, const char *replacement, const char *haystack)
{
ssize_t len = -1, saved_len = -1;
char *result = NULL;
size_t replacement_len = strlen(replacement);
size_t needle_len = strlen(needle);
/* should be executed exactly twice */
while (len == -1 || result == NULL) {
cha... | null | 0 | char *lxc_string_replace(const char *needle, const char *replacement, const char *haystack)
{
ssize_t len = -1, saved_len = -1;
char *result = NULL;
size_t replacement_len = strlen(replacement);
size_t needle_len = strlen(needle);
/* should be executed exactly twice */
while (len == -1 || result == NULL) {
cha... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,826 | char** lxc_va_arg_list_to_argv(va_list ap, size_t skip, int do_strdup)
{
va_list ap2;
size_t count = 1 + skip;
char **result;
/* first determine size of argument list, we don't want to reallocate
* constantly...
*/
va_copy(ap2, ap);
while (1) {
char* arg = va_arg(ap2, char*);
if (!arg)
break;
count+... | null | 0 | char** lxc_va_arg_list_to_argv(va_list ap, size_t skip, int do_strdup)
{
va_list ap2;
size_t count = 1 + skip;
char **result;
/* first determine size of argument list, we don't want to reallocate
* constantly...
*/
va_copy(ap2, ap);
while (1) {
char* arg = va_arg(ap2, char*);
if (!arg)
break;
count+... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,827 | const char** lxc_va_arg_list_to_argv_const(va_list ap, size_t skip)
{
return (const char**)lxc_va_arg_list_to_argv(ap, skip, 0);
}
| null | 0 | const char** lxc_va_arg_list_to_argv_const(va_list ap, size_t skip)
{
return (const char**)lxc_va_arg_list_to_argv(ap, skip, 0);
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,828 | int lxc_wait_for_pid_status(pid_t pid)
{
int status, ret;
again:
ret = waitpid(pid, &status, 0);
if (ret == -1) {
if (errno == EINTR)
goto again;
return -1;
}
if (ret != pid)
goto again;
return status;
}
| null | 0 | int lxc_wait_for_pid_status(pid_t pid)
{
int status, ret;
again:
ret = waitpid(pid, &status, 0);
if (ret == -1) {
if (errno == EINTR)
goto again;
return -1;
}
if (ret != pid)
goto again;
return status;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,829 | ssize_t lxc_write_nointr(int fd, const void* buf, size_t count)
{
ssize_t ret;
again:
ret = write(fd, buf, count);
if (ret < 0 && errno == EINTR)
goto again;
return ret;
}
| null | 0 | ssize_t lxc_write_nointr(int fd, const void* buf, size_t count)
{
ssize_t ret;
again:
ret = write(fd, buf, count);
if (ret < 0 && errno == EINTR)
goto again;
return ret;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,830 | int lxc_write_to_file(const char *filename, const void* buf, size_t count, bool add_newline)
{
int fd, saved_errno;
ssize_t ret;
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0666);
if (fd < 0)
return -1;
ret = lxc_write_nointr(fd, buf, count);
if (ret < 0)
goto out_error;
if ((size_t)ret !=... | null | 0 | int lxc_write_to_file(const char *filename, const void* buf, size_t count, bool add_newline)
{
int fd, saved_errno;
ssize_t ret;
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0666);
if (fd < 0)
return -1;
ret = lxc_write_nointr(fd, buf, count);
if (ret < 0)
goto out_error;
if ((size_t)ret !=... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,831 | extern int mkdir_p(const char *dir, mode_t mode)
{
const char *tmp = dir;
const char *orig = dir;
char *makeme;
do {
dir = tmp + strspn(tmp, "/");
tmp = dir + strcspn(dir, "/");
makeme = strndup(orig, dir - orig);
if (*makeme) {
if (mkdir(makeme, mode) && errno != EEXIST) {
SYSERROR("failed to creat... | null | 0 | extern int mkdir_p(const char *dir, mode_t mode)
{
const char *tmp = dir;
const char *orig = dir;
char *makeme;
do {
dir = tmp + strspn(tmp, "/");
tmp = dir + strcspn(dir, "/");
makeme = strndup(orig, dir - orig);
if (*makeme) {
if (mkdir(makeme, mode) && errno != EEXIST) {
SYSERROR("failed to creat... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,832 | int null_stdfds(void)
{
int fd, ret = -1;
fd = open("/dev/null", O_RDWR);
if (fd < 0)
return -1;
if (dup2(fd, 0) < 0)
goto err;
if (dup2(fd, 1) < 0)
goto err;
if (dup2(fd, 2) < 0)
goto err;
ret = 0;
err:
close(fd);
return ret;
}
| null | 0 | int null_stdfds(void)
{
int fd, ret = -1;
fd = open("/dev/null", O_RDWR);
if (fd < 0)
return -1;
if (dup2(fd, 0) < 0)
goto err;
if (dup2(fd, 1) < 0)
goto err;
if (dup2(fd, 2) < 0)
goto err;
ret = 0;
err:
close(fd);
return ret;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,833 | char *on_path(char *cmd, const char *rootfs) {
char *path = NULL;
char *entry = NULL;
char *saveptr = NULL;
char cmdpath[MAXPATHLEN];
int ret;
path = getenv("PATH");
if (!path)
return NULL;
path = strdup(path);
if (!path)
return NULL;
entry = strtok_r(path, ":", &saveptr);
while (entry) {
if (rootfs... | null | 0 | char *on_path(char *cmd, const char *rootfs) {
char *path = NULL;
char *entry = NULL;
char *saveptr = NULL;
char cmdpath[MAXPATHLEN];
int ret;
path = getenv("PATH");
if (!path)
return NULL;
path = strdup(path);
if (!path)
return NULL;
entry = strtok_r(path, ":", &saveptr);
while (entry) {
if (rootfs... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,834 | int print_to_file(const char *file, const char *content)
{
FILE *f;
int ret = 0;
f = fopen(file, "w");
if (!f)
return -1;
if (fprintf(f, "%s", content) != strlen(content))
ret = -1;
fclose(f);
return ret;
}
| null | 0 | int print_to_file(const char *file, const char *content)
{
FILE *f;
int ret = 0;
f = fopen(file, "w");
if (!f)
return -1;
if (fprintf(f, "%s", content) != strlen(content))
ret = -1;
fclose(f);
return ret;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,835 | int randseed(bool srand_it)
{
/*
srand pre-seed function based on /dev/urandom
*/
unsigned int seed=time(NULL)+getpid();
FILE *f;
f = fopen("/dev/urandom", "r");
if (f) {
int ret = fread(&seed, sizeof(seed), 1, f);
if (ret != 1)
DEBUG("unable to fread /dev/urandom, %s, fallback to time+pid rand see... | null | 0 | int randseed(bool srand_it)
{
/*
srand pre-seed function based on /dev/urandom
*/
unsigned int seed=time(NULL)+getpid();
FILE *f;
f = fopen("/dev/urandom", "r");
if (f) {
int ret = fread(&seed, sizeof(seed), 1, f);
if (ret != 1)
DEBUG("unable to fread /dev/urandom, %s, fallback to time+pid rand see... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,836 | int sha1sum_file(char *fnam, unsigned char *digest)
{
char *buf;
int ret;
FILE *f;
long flen;
if (!fnam)
return -1;
f = fopen_cloexec(fnam, "r");
if (!f) {
SYSERROR("Error opening template");
return -1;
}
if (fseek(f, 0, SEEK_END) < 0) {
SYSERROR("Error seeking to end of template");
fclose(f);
ret... | null | 0 | int sha1sum_file(char *fnam, unsigned char *digest)
{
char *buf;
int ret;
FILE *f;
long flen;
if (!fnam)
return -1;
f = fopen_cloexec(fnam, "r");
if (!f) {
SYSERROR("Error opening template");
return -1;
}
if (fseek(f, 0, SEEK_END) < 0) {
SYSERROR("Error seeking to end of template");
fclose(f);
ret... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,837 | bool switch_to_ns(pid_t pid, const char *ns) {
int fd, ret;
char nspath[MAXPATHLEN];
/* Switch to new ns */
ret = snprintf(nspath, MAXPATHLEN, "/proc/%d/ns/%s", pid, ns);
if (ret < 0 || ret >= MAXPATHLEN)
return false;
fd = open(nspath, O_RDONLY);
if (fd < 0) {
SYSERROR("failed to open %s", nspath);
retu... | null | 0 | bool switch_to_ns(pid_t pid, const char *ns) {
int fd, ret;
char nspath[MAXPATHLEN];
/* Switch to new ns */
ret = snprintf(nspath, MAXPATHLEN, "/proc/%d/ns/%s", pid, ns);
if (ret < 0 || ret >= MAXPATHLEN)
return false;
fd = open(nspath, O_RDONLY);
if (fd < 0) {
SYSERROR("failed to open %s", nspath);
retu... | @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,838 | int wait_for_pid(pid_t pid)
{
int status, ret;
again:
ret = waitpid(pid, &status, 0);
if (ret == -1) {
if (errno == EINTR)
goto again;
return -1;
}
if (ret != pid)
goto again;
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
return -1;
return 0;
}
| null | 0 | int wait_for_pid(pid_t pid)
{
int status, ret;
again:
ret = waitpid(pid, &status, 0);
if (ret == -1) {
if (errno == EINTR)
goto again;
return -1;
}
if (ret != pid)
goto again;
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
return -1;
return 0;
}
| @@ -1404,6 +1404,239 @@ int setproctitle(char *title)
return ret;
}
+/*
+ * @path: a pathname where / replaced with '\0'.
+ * @offsetp: pointer to int showing which path segment was last seen.
+ * Updated on return to reflect the next segment.
+ * @fulllen: full original path length.
+ * Returns a poi... | CWE-59 | null | null |
35,839 | static bool fetch_seccomp(const char *name, const char *lxcpath,
struct lxc_proc_context_info *i, lxc_attach_options_t *options)
{
struct lxc_container *c;
if (!(options->namespaces & CLONE_NEWNS) || !(options->attach_flags & LXC_ATTACH_LSM))
return true;
c = lxc_container_new(name, lxcpath);
if (!c)
return... | null | 0 | static bool fetch_seccomp(const char *name, const char *lxcpath,
struct lxc_proc_context_info *i, lxc_attach_options_t *options)
{
struct lxc_container *c;
if (!(options->namespaces & CLONE_NEWNS) || !(options->attach_flags & LXC_ATTACH_LSM))
return true;
c = lxc_container_new(name, lxcpath);
if (!c)
return... | @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,840 | static signed long get_personality(const char *name, const char *lxcpath)
{
char *p = lxc_cmd_get_config_item(name, "lxc.arch", lxcpath);
signed long ret;
if (!p)
return -1;
ret = lxc_config_parse_arch(p);
free(p);
return ret;
}
| null | 0 | static signed long get_personality(const char *name, const char *lxcpath)
{
char *p = lxc_cmd_get_config_item(name, "lxc.arch", lxcpath);
signed long ret;
if (!p)
return -1;
ret = lxc_config_parse_arch(p);
free(p);
return ret;
}
| @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,841 | static int lxc_attach_drop_privs(struct lxc_proc_context_info *ctx)
{
int last_cap = lxc_caps_last_cap();
int cap;
for (cap = 0; cap <= last_cap; cap++) {
if (ctx->capability_mask & (1LL << cap))
continue;
if (prctl(PR_CAPBSET_DROP, cap, 0, 0, 0)) {
SYSERROR("failed to remove capability id %d", cap);
... | null | 0 | static int lxc_attach_drop_privs(struct lxc_proc_context_info *ctx)
{
int last_cap = lxc_caps_last_cap();
int cap;
for (cap = 0; cap <= last_cap; cap++) {
if (ctx->capability_mask & (1LL << cap))
continue;
if (prctl(PR_CAPBSET_DROP, cap, 0, 0, 0)) {
SYSERROR("failed to remove capability id %d", cap);
... | @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,842 | static void lxc_attach_get_init_uidgid(uid_t* init_uid, gid_t* init_gid)
{
FILE *proc_file;
char proc_fn[MAXPATHLEN];
char *line = NULL;
size_t line_bufsz = 0;
int ret;
long value = -1;
uid_t uid = (uid_t)-1;
gid_t gid = (gid_t)-1;
/* read capabilities */
snprintf(proc_fn, MAXPATHLEN, "/proc/%d/status", 1);
... | null | 0 | static void lxc_attach_get_init_uidgid(uid_t* init_uid, gid_t* init_gid)
{
FILE *proc_file;
char proc_fn[MAXPATHLEN];
char *line = NULL;
size_t line_bufsz = 0;
int ret;
long value = -1;
uid_t uid = (uid_t)-1;
gid_t gid = (gid_t)-1;
/* read capabilities */
snprintf(proc_fn, MAXPATHLEN, "/proc/%d/status", 1);
... | @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,843 | static int lxc_attach_remount_sys_proc(void)
{
int ret;
ret = unshare(CLONE_NEWNS);
if (ret < 0) {
SYSERROR("failed to unshare mount namespace");
return -1;
}
if (detect_shared_rootfs()) {
if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
SYSERROR("Failed to make / rslave");
ERROR("Continuing...")... | null | 0 | static int lxc_attach_remount_sys_proc(void)
{
int ret;
ret = unshare(CLONE_NEWNS);
if (ret < 0) {
SYSERROR("failed to unshare mount namespace");
return -1;
}
if (detect_shared_rootfs()) {
if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
SYSERROR("Failed to make / rslave");
ERROR("Continuing...")... | @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,844 | int lxc_attach_run_shell(void* payload)
{
uid_t uid;
struct passwd *passwd;
char *user_shell;
/* ignore payload parameter */
(void)payload;
uid = getuid();
passwd = getpwuid(uid);
/* this probably happens because of incompatible nss
* implementations in host and container (remember, this
* code is still ... | null | 0 | int lxc_attach_run_shell(void* payload)
{
uid_t uid;
struct passwd *passwd;
char *user_shell;
/* ignore payload parameter */
(void)payload;
uid = getuid();
passwd = getpwuid(uid);
/* this probably happens because of incompatible nss
* implementations in host and container (remember, this
* code is still ... | @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,845 | static struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
{
struct lxc_proc_context_info *info = calloc(1, sizeof(*info));
FILE *proc_file;
char proc_fn[MAXPATHLEN];
char *line = NULL;
size_t line_bufsz = 0;
int ret, found;
if (!info) {
SYSERROR("Could not allocate memory.");
return NULL;... | null | 0 | static struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
{
struct lxc_proc_context_info *info = calloc(1, sizeof(*info));
FILE *proc_file;
char proc_fn[MAXPATHLEN];
char *line = NULL;
size_t line_bufsz = 0;
int ret, found;
if (!info) {
SYSERROR("Could not allocate memory.");
return NULL;... | @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,846 | static void lxc_proc_put_context_info(struct lxc_proc_context_info *ctx)
{
free(ctx->lsm_label);
if (ctx->container)
lxc_container_put(ctx->container);
free(ctx);
}
| null | 0 | static void lxc_proc_put_context_info(struct lxc_proc_context_info *ctx)
{
free(ctx->lsm_label);
if (ctx->container)
lxc_container_put(ctx->container);
free(ctx);
}
| @@ -76,6 +76,82 @@
lxc_log_define(lxc_attach, lxc);
+int lsm_set_label_at(int procfd, int on_exec, char* lsm_label) {
+ int labelfd = -1;
+ int ret = 0;
+ const char* name;
+ char* command = NULL;
+
+ name = lsm_name();
+
+ if (strcmp(name, "nop") == 0)
+ goto out;
+
+ if (strcmp(name, "none") == 0)
+ goto out;
... | CWE-17 | null | null |
35,847 | void __key_link(struct key *key, struct assoc_array_edit **_edit)
{
__key_get(key);
assoc_array_insert_set_object(*_edit, keyring_key_to_ptr(key));
assoc_array_apply_edit(*_edit);
*_edit = NULL;
}
| DoS Overflow | 0 | void __key_link(struct key *key, struct assoc_array_edit **_edit)
{
__key_get(key);
assoc_array_insert_set_object(*_edit, keyring_key_to_ptr(key));
assoc_array_apply_edit(*_edit);
*_edit = NULL;
}
| @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,848 | key_ref_t find_key_to_update(key_ref_t keyring_ref,
const struct keyring_index_key *index_key)
{
struct key *keyring, *key;
const void *object;
keyring = key_ref_to_ptr(keyring_ref);
kenter("{%d},{%s,%s}",
keyring->serial, index_key->type->name, index_key->description);
object = assoc_array_find... | DoS Overflow | 0 | key_ref_t find_key_to_update(key_ref_t keyring_ref,
const struct keyring_index_key *index_key)
{
struct key *keyring, *key;
const void *object;
keyring = key_ref_to_ptr(keyring_ref);
kenter("{%d},{%s,%s}",
keyring->serial, index_key->type->name, index_key->description);
object = assoc_array_find... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,849 | struct key *find_keyring_by_name(const char *name, bool skip_perm_check)
{
struct key *keyring;
int bucket;
if (!name)
return ERR_PTR(-EINVAL);
bucket = keyring_hash(name);
read_lock(&keyring_name_lock);
if (keyring_name_hash[bucket].next) {
/* search this hash bucket for a keyring with a matching name
... | DoS Overflow | 0 | struct key *find_keyring_by_name(const char *name, bool skip_perm_check)
{
struct key *keyring;
int bucket;
if (!name)
return ERR_PTR(-EINVAL);
bucket = keyring_hash(name);
read_lock(&keyring_name_lock);
if (keyring_name_hash[bucket].next) {
/* search this hash bucket for a keyring with a matching name
... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,850 | static unsigned long hash_key_type_and_desc(const struct keyring_index_key *index_key)
{
const unsigned level_shift = ASSOC_ARRAY_LEVEL_STEP;
const unsigned long fan_mask = ASSOC_ARRAY_FAN_MASK;
const char *description = index_key->description;
unsigned long hash, type;
u32 piece;
u64 acc;
int n, desc_len = inde... | DoS Overflow | 0 | static unsigned long hash_key_type_and_desc(const struct keyring_index_key *index_key)
{
const unsigned level_shift = ASSOC_ARRAY_LEVEL_STEP;
const unsigned long fan_mask = ASSOC_ARRAY_FAN_MASK;
const char *description = index_key->description;
unsigned long hash, type;
u32 piece;
u64 acc;
int n, desc_len = inde... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,851 | bool key_default_cmp(const struct key *key,
const struct key_match_data *match_data)
{
return strcmp(key->description, match_data->raw_data) == 0;
}
| DoS Overflow | 0 | bool key_default_cmp(const struct key *key,
const struct key_match_data *match_data)
{
return strcmp(key->description, match_data->raw_data) == 0;
}
| @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,852 | int key_link(struct key *keyring, struct key *key)
{
struct assoc_array_edit *edit;
int ret;
kenter("{%d,%d}", keyring->serial, atomic_read(&keyring->usage));
key_check(keyring);
key_check(key);
if (test_bit(KEY_FLAG_TRUSTED_ONLY, &keyring->flags) &&
!test_bit(KEY_FLAG_TRUSTED, &key->flags))
return -EPE... | DoS Overflow | 0 | int key_link(struct key *keyring, struct key *key)
{
struct assoc_array_edit *edit;
int ret;
kenter("{%d,%d}", keyring->serial, atomic_read(&keyring->usage));
key_check(keyring);
key_check(key);
if (test_bit(KEY_FLAG_TRUSTED_ONLY, &keyring->flags) &&
!test_bit(KEY_FLAG_TRUSTED, &key->flags))
return -EPE... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,853 | int key_unlink(struct key *keyring, struct key *key)
{
struct assoc_array_edit *edit;
int ret;
key_check(keyring);
key_check(key);
if (keyring->type != &key_type_keyring)
return -ENOTDIR;
down_write(&keyring->sem);
edit = assoc_array_delete(&keyring->keys, &keyring_assoc_array_ops,
&key->index_key);
... | DoS Overflow | 0 | int key_unlink(struct key *keyring, struct key *key)
{
struct assoc_array_edit *edit;
int ret;
key_check(keyring);
key_check(key);
if (keyring->type != &key_type_keyring)
return -ENOTDIR;
down_write(&keyring->sem);
edit = assoc_array_delete(&keyring->keys, &keyring_assoc_array_ops,
&key->index_key);
... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,854 | struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid,
const struct cred *cred, key_perm_t perm,
unsigned long flags, struct key *dest)
{
struct key *keyring;
int ret;
keyring = key_alloc(&key_type_keyring, description,
uid, gid, cred, perm, flags);
if (!IS_ERR(keyring)) {
re... | DoS Overflow | 0 | struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid,
const struct cred *cred, key_perm_t perm,
unsigned long flags, struct key *dest)
{
struct key *keyring;
int ret;
keyring = key_alloc(&key_type_keyring, description,
uid, gid, cred, perm, flags);
if (!IS_ERR(keyring)) {
re... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,855 | int keyring_clear(struct key *keyring)
{
struct assoc_array_edit *edit;
int ret;
if (keyring->type != &key_type_keyring)
return -ENOTDIR;
down_write(&keyring->sem);
edit = assoc_array_clear(&keyring->keys, &keyring_assoc_array_ops);
if (IS_ERR(edit)) {
ret = PTR_ERR(edit);
} else {
if (edit)
assoc_ar... | DoS Overflow | 0 | int keyring_clear(struct key *keyring)
{
struct assoc_array_edit *edit;
int ret;
if (keyring->type != &key_type_keyring)
return -ENOTDIR;
down_write(&keyring->sem);
edit = assoc_array_clear(&keyring->keys, &keyring_assoc_array_ops);
if (IS_ERR(edit)) {
ret = PTR_ERR(edit);
} else {
if (edit)
assoc_ar... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,856 | static void keyring_describe(const struct key *keyring, struct seq_file *m)
{
if (keyring->description)
seq_puts(m, keyring->description);
else
seq_puts(m, "[anon]");
if (key_is_instantiated(keyring)) {
if (keyring->keys.nr_leaves_on_tree != 0)
seq_printf(m, ": %lu", keyring->keys.nr_leaves_on_tree);
els... | DoS Overflow | 0 | static void keyring_describe(const struct key *keyring, struct seq_file *m)
{
if (keyring->description)
seq_puts(m, keyring->description);
else
seq_puts(m, "[anon]");
if (key_is_instantiated(keyring)) {
if (keyring->keys.nr_leaves_on_tree != 0)
seq_printf(m, ": %lu", keyring->keys.nr_leaves_on_tree);
els... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,857 | static int keyring_detect_cycle(struct key *A, struct key *B)
{
struct keyring_search_context ctx = {
.index_key = A->index_key,
.match_data.raw_data = A,
.match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT,
.iterator = keyring_detect_cycle_iterator,
.flags = (KEYRING_SEARCH_NO_STATE_CHECK |
K... | DoS Overflow | 0 | static int keyring_detect_cycle(struct key *A, struct key *B)
{
struct keyring_search_context ctx = {
.index_key = A->index_key,
.match_data.raw_data = A,
.match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT,
.iterator = keyring_detect_cycle_iterator,
.flags = (KEYRING_SEARCH_NO_STATE_CHECK |
K... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,858 | static int keyring_detect_cycle_iterator(const void *object,
void *iterator_data)
{
struct keyring_search_context *ctx = iterator_data;
const struct key *key = keyring_ptr_to_key(object);
kenter("{%d}", key->serial);
/* We might get a keyring with matching index-key that is nonetheless a
* different keyri... | DoS Overflow | 0 | static int keyring_detect_cycle_iterator(const void *object,
void *iterator_data)
{
struct keyring_search_context *ctx = iterator_data;
const struct key *key = keyring_ptr_to_key(object);
kenter("{%d}", key->serial);
/* We might get a keyring with matching index-key that is nonetheless a
* different keyri... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,859 | static void keyring_free_preparse(struct key_preparsed_payload *prep)
{
}
| DoS Overflow | 0 | static void keyring_free_preparse(struct key_preparsed_payload *prep)
{
}
| @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,860 | void keyring_gc(struct key *keyring, time_t limit)
{
int result;
kenter("%x{%s}", keyring->serial, keyring->description ?: "");
if (keyring->flags & ((1 << KEY_FLAG_INVALIDATED) |
(1 << KEY_FLAG_REVOKED)))
goto dont_gc;
/* scan the keyring looking for dead keys */
rcu_read_lock();
result = assoc_arr... | DoS Overflow | 0 | void keyring_gc(struct key *keyring, time_t limit)
{
int result;
kenter("%x{%s}", keyring->serial, keyring->description ?: "");
if (keyring->flags & ((1 << KEY_FLAG_INVALIDATED) |
(1 << KEY_FLAG_REVOKED)))
goto dont_gc;
/* scan the keyring looking for dead keys */
rcu_read_lock();
result = assoc_arr... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,861 | static unsigned long keyring_get_key_chunk(const void *data, int level)
{
const struct keyring_index_key *index_key = data;
unsigned long chunk = 0;
long offset = 0;
int desc_len = index_key->desc_len, n = sizeof(chunk);
level /= ASSOC_ARRAY_KEY_CHUNK_SIZE;
switch (level) {
case 0:
return hash_key_type_and_de... | DoS Overflow | 0 | static unsigned long keyring_get_key_chunk(const void *data, int level)
{
const struct keyring_index_key *index_key = data;
unsigned long chunk = 0;
long offset = 0;
int desc_len = index_key->desc_len, n = sizeof(chunk);
level /= ASSOC_ARRAY_KEY_CHUNK_SIZE;
switch (level) {
case 0:
return hash_key_type_and_de... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,862 | static unsigned long keyring_get_object_key_chunk(const void *object, int level)
{
const struct key *key = keyring_ptr_to_key(object);
return keyring_get_key_chunk(&key->index_key, level);
}
| DoS Overflow | 0 | static unsigned long keyring_get_object_key_chunk(const void *object, int level)
{
const struct key *key = keyring_ptr_to_key(object);
return keyring_get_key_chunk(&key->index_key, level);
}
| @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,863 | static inline void *keyring_key_to_ptr(struct key *key)
{
if (key->type == &key_type_keyring)
return (void *)((unsigned long)key | KEYRING_PTR_SUBTYPE);
return key;
}
| DoS Overflow | 0 | static inline void *keyring_key_to_ptr(struct key *key)
{
if (key->type == &key_type_keyring)
return (void *)((unsigned long)key | KEYRING_PTR_SUBTYPE);
return key;
}
| @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,864 | static void keyring_publish_name(struct key *keyring)
{
int bucket;
if (keyring->description) {
bucket = keyring_hash(keyring->description);
write_lock(&keyring_name_lock);
if (!keyring_name_hash[bucket].next)
INIT_LIST_HEAD(&keyring_name_hash[bucket]);
list_add_tail(&keyring->type_data.link,
... | DoS Overflow | 0 | static void keyring_publish_name(struct key *keyring)
{
int bucket;
if (keyring->description) {
bucket = keyring_hash(keyring->description);
write_lock(&keyring_name_lock);
if (!keyring_name_hash[bucket].next)
INIT_LIST_HEAD(&keyring_name_hash[bucket]);
list_add_tail(&keyring->type_data.link,
... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,865 | static long keyring_read(const struct key *keyring,
char __user *buffer, size_t buflen)
{
struct keyring_read_iterator_context ctx;
unsigned long nr_keys;
int ret;
kenter("{%d},,%zu", key_serial(keyring), buflen);
if (buflen & (sizeof(key_serial_t) - 1))
return -EINVAL;
nr_keys = keyring->keys.nr_leaves_... | DoS Overflow | 0 | static long keyring_read(const struct key *keyring,
char __user *buffer, size_t buflen)
{
struct keyring_read_iterator_context ctx;
unsigned long nr_keys;
int ret;
kenter("{%d},,%zu", key_serial(keyring), buflen);
if (buflen & (sizeof(key_serial_t) - 1))
return -EINVAL;
nr_keys = keyring->keys.nr_leaves_... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,866 | static int keyring_read_iterator(const void *object, void *data)
{
struct keyring_read_iterator_context *ctx = data;
const struct key *key = keyring_ptr_to_key(object);
int ret;
kenter("{%s,%d},,{%zu/%zu}",
key->type->name, key->serial, ctx->count, ctx->qty);
if (ctx->count >= ctx->qty)
return 1;
ret... | DoS Overflow | 0 | static int keyring_read_iterator(const void *object, void *data)
{
struct keyring_read_iterator_context *ctx = data;
const struct key *key = keyring_ptr_to_key(object);
int ret;
kenter("{%s,%d},,{%zu/%zu}",
key->type->name, key->serial, ctx->count, ctx->qty);
if (ctx->count >= ctx->qty)
return 1;
ret... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,867 | static void keyring_revoke(struct key *keyring)
{
struct assoc_array_edit *edit;
edit = assoc_array_clear(&keyring->keys, &keyring_assoc_array_ops);
if (!IS_ERR(edit)) {
if (edit)
assoc_array_apply_edit(edit);
key_payload_reserve(keyring, 0);
}
}
| DoS Overflow | 0 | static void keyring_revoke(struct key *keyring)
{
struct assoc_array_edit *edit;
edit = assoc_array_clear(&keyring->keys, &keyring_assoc_array_ops);
if (!IS_ERR(edit)) {
if (edit)
assoc_array_apply_edit(edit);
key_payload_reserve(keyring, 0);
}
}
| @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,868 | key_ref_t keyring_search(key_ref_t keyring,
struct key_type *type,
const char *description)
{
struct keyring_search_context ctx = {
.index_key.type = type,
.index_key.description = description,
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
.match... | DoS Overflow | 0 | key_ref_t keyring_search(key_ref_t keyring,
struct key_type *type,
const char *description)
{
struct keyring_search_context ctx = {
.index_key.type = type,
.index_key.description = description,
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
.match... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,869 | key_ref_t keyring_search_aux(key_ref_t keyring_ref,
struct keyring_search_context *ctx)
{
struct key *keyring;
long err;
ctx->iterator = keyring_search_iterator;
ctx->possessed = is_key_possessed(keyring_ref);
ctx->result = ERR_PTR(-EAGAIN);
keyring = key_ref_to_ptr(keyring_ref);
key_check(keyring);
... | DoS Overflow | 0 | key_ref_t keyring_search_aux(key_ref_t keyring_ref,
struct keyring_search_context *ctx)
{
struct key *keyring;
long err;
ctx->iterator = keyring_search_iterator;
ctx->possessed = is_key_possessed(keyring_ref);
ctx->result = ERR_PTR(-EAGAIN);
keyring = key_ref_to_ptr(keyring_ref);
key_check(keyring);
... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,870 | static u64 mult_64x32_and_fold(u64 x, u32 y)
{
u64 hi = (u64)(u32)(x >> 32) * y;
u64 lo = (u64)(u32)(x) * y;
return lo + ((u64)(u32)hi << 32) + (u32)(hi >> 32);
}
| DoS Overflow | 0 | static u64 mult_64x32_and_fold(u64 x, u32 y)
{
u64 hi = (u64)(u32)(x >> 32) * y;
u64 lo = (u64)(u32)(x) * y;
return lo + ((u64)(u32)hi << 32) + (u32)(hi >> 32);
}
| @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,871 | static bool search_nested_keyrings(struct key *keyring,
struct keyring_search_context *ctx)
{
struct {
struct key *keyring;
struct assoc_array_node *node;
int slot;
} stack[KEYRING_SEARCH_MAX_DEPTH];
struct assoc_array_shortcut *shortcut;
struct assoc_array_node *node;
struct assoc_array_ptr *ptr;
s... | DoS Overflow | 0 | static bool search_nested_keyrings(struct key *keyring,
struct keyring_search_context *ctx)
{
struct {
struct key *keyring;
struct assoc_array_node *node;
int slot;
} stack[KEYRING_SEARCH_MAX_DEPTH];
struct assoc_array_shortcut *shortcut;
struct assoc_array_node *node;
struct assoc_array_ptr *ptr;
s... | @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);
- if (edit && !edit->dead_leaf) {
- key_payload_reserve(keyring,
- keyring->datalen - KEYQUOTA_LINK_BYTES);
+ if (edit) {
+ if (!edit->dead_leaf) {
+ key_pay... | CWE-119 | null | null |
35,872 | int container_disk_lock(struct lxc_container *c)
{
int ret;
if ((ret = lxclock(c->privlock, 0)))
return ret;
if ((ret = lxclock(c->slock, 0))) {
lxcunlock(c->privlock);
return ret;
}
return 0;
}
| null | 0 | int container_disk_lock(struct lxc_container *c)
{
int ret;
if ((ret = lxclock(c->privlock, 0)))
return ret;
if ((ret = lxclock(c->slock, 0))) {
lxcunlock(c->privlock);
return ret;
}
return 0;
}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,873 | void container_mem_unlock(struct lxc_container *c)
{
lxcunlock(c->privlock);
}
| null | 0 | void container_mem_unlock(struct lxc_container *c)
{
lxcunlock(c->privlock);
}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,874 | static inline void dump_stacktrace(void) {;}
| null | 0 | static inline void dump_stacktrace(void) {;}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,875 | static void lock_mutex(pthread_mutex_t *l)
{
int ret;
if ((ret = pthread_mutex_lock(l)) != 0) {
fprintf(stderr, "pthread_mutex_lock returned:%d %s\n", ret, strerror(ret));
dump_stacktrace();
exit(1);
}
}
| null | 0 | static void lock_mutex(pthread_mutex_t *l)
{
int ret;
if ((ret = pthread_mutex_lock(l)) != 0) {
fprintf(stderr, "pthread_mutex_lock returned:%d %s\n", ret, strerror(ret));
dump_stacktrace();
exit(1);
}
}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,876 | static sem_t *lxc_new_unnamed_sem(void)
{
sem_t *s;
int ret;
s = malloc(sizeof(*s));
if (!s)
return NULL;
ret = sem_init(s, 0, 1);
if (ret) {
free(s);
return NULL;
}
return s;
}
| null | 0 | static sem_t *lxc_new_unnamed_sem(void)
{
sem_t *s;
int ret;
s = malloc(sizeof(*s));
if (!s)
return NULL;
ret = sem_init(s, 0, 1);
if (ret) {
free(s);
return NULL;
}
return s;
}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,877 | struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name)
{
struct lxc_lock *l;
l = malloc(sizeof(*l));
if (!l)
goto out;
if (!name) {
l->type = LXC_LOCK_ANON_SEM;
l->u.sem = lxc_new_unnamed_sem();
if (!l->u.sem) {
free(l);
l = NULL;
}
goto out;
}
l->type = LXC_LOCK_FLOCK;
l->u.f.f... | null | 0 | struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name)
{
struct lxc_lock *l;
l = malloc(sizeof(*l));
if (!l)
goto out;
if (!name) {
l->type = LXC_LOCK_ANON_SEM;
l->u.sem = lxc_new_unnamed_sem();
if (!l->u.sem) {
free(l);
l = NULL;
}
goto out;
}
l->type = LXC_LOCK_FLOCK;
l->u.f.f... | @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,878 | void lxc_putlock(struct lxc_lock *l)
{
if (!l)
return;
switch(l->type) {
case LXC_LOCK_ANON_SEM:
if (l->u.sem) {
sem_destroy(l->u.sem);
free(l->u.sem);
l->u.sem = NULL;
}
break;
case LXC_LOCK_FLOCK:
if (l->u.f.fd != -1) {
close(l->u.f.fd);
l->u.f.fd = -1;
}
free(l->u.f.fname);
l->u.f.... | null | 0 | void lxc_putlock(struct lxc_lock *l)
{
if (!l)
return;
switch(l->type) {
case LXC_LOCK_ANON_SEM:
if (l->u.sem) {
sem_destroy(l->u.sem);
free(l->u.sem);
l->u.sem = NULL;
}
break;
case LXC_LOCK_FLOCK:
if (l->u.f.fd != -1) {
close(l->u.f.fd);
l->u.f.fd = -1;
}
free(l->u.f.fname);
l->u.f.... | @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,879 | int lxclock(struct lxc_lock *l, int timeout)
{
int ret = -1, saved_errno = errno;
struct flock lk;
switch(l->type) {
case LXC_LOCK_ANON_SEM:
if (!timeout) {
ret = sem_wait(l->u.sem);
if (ret == -1)
saved_errno = errno;
} else {
struct timespec ts;
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {... | null | 0 | int lxclock(struct lxc_lock *l, int timeout)
{
int ret = -1, saved_errno = errno;
struct flock lk;
switch(l->type) {
case LXC_LOCK_ANON_SEM:
if (!timeout) {
ret = sem_wait(l->u.sem);
if (ret == -1)
saved_errno = errno;
} else {
struct timespec ts;
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {... | @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,880 | int lxcunlock(struct lxc_lock *l)
{
int ret = 0, saved_errno = errno;
struct flock lk;
switch(l->type) {
case LXC_LOCK_ANON_SEM:
if (!l->u.sem)
ret = -2;
else {
ret = sem_post(l->u.sem);
saved_errno = errno;
}
break;
case LXC_LOCK_FLOCK:
if (l->u.f.fd != -1) {
lk.l_type = F_UNLCK;
lk.l_wh... | null | 0 | int lxcunlock(struct lxc_lock *l)
{
int ret = 0, saved_errno = errno;
struct flock lk;
switch(l->type) {
case LXC_LOCK_ANON_SEM:
if (!l->u.sem)
ret = -2;
else {
ret = sem_post(l->u.sem);
saved_errno = errno;
}
break;
case LXC_LOCK_FLOCK:
if (l->u.f.fd != -1) {
lk.l_type = F_UNLCK;
lk.l_wh... | @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,881 | void process_lock(void)
{
lock_mutex(&thread_mutex);
}
| null | 0 | void process_lock(void)
{
lock_mutex(&thread_mutex);
}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,882 | void process_unlock(void)
{
unlock_mutex(&thread_mutex);
}
| null | 0 | void process_unlock(void)
{
unlock_mutex(&thread_mutex);
}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,883 | static void unlock_mutex(pthread_mutex_t *l)
{
int ret;
if ((ret = pthread_mutex_unlock(l)) != 0) {
fprintf(stderr, "pthread_mutex_unlock returned:%d %s\n", ret, strerror(ret));
dump_stacktrace();
exit(1);
}
}
| null | 0 | static void unlock_mutex(pthread_mutex_t *l)
{
int ret;
if ((ret = pthread_mutex_unlock(l)) != 0) {
fprintf(stderr, "pthread_mutex_unlock returned:%d %s\n", ret, strerror(ret));
dump_stacktrace();
exit(1);
}
}
| @@ -103,13 +103,13 @@ static char *lxclock_name(const char *p, const char *n)
char *rundir;
/* lockfile will be:
- * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
+ * "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
- * $XDG_RUNTIME_DIR + "/lock/lxc/$lxcpath/$lxcname + '\0' if non-root
+ * ... | CWE-59 | null | null |
35,884 | static void test_two_locks(void)
{
struct lxc_lock *l;
pid_t pid;
int ret, status;
int p[2];
char c;
if (pipe(p) < 0)
exit(1);
if ((pid = fork()) < 0)
exit(1);
if (pid == 0) {
if (read(p[0], &c, 1) < 0) {
perror("read");
exit(1);
}
l = lxc_newlock("/tmp", "lxctest-sem");
if (!l) {
fprintf(... | null | 0 | static void test_two_locks(void)
{
struct lxc_lock *l;
pid_t pid;
int ret, status;
int p[2];
char c;
if (pipe(p) < 0)
exit(1);
if ((pid = fork()) < 0)
exit(1);
if (pid == 0) {
if (read(p[0], &c, 1) < 0) {
perror("read");
exit(1);
}
l = lxc_newlock("/tmp", "lxctest-sem");
if (!l) {
fprintf(... | @@ -122,7 +122,7 @@ int main(int argc, char *argv[])
exit(1);
}
struct stat sb;
- char *pathname = RUNTIME_PATH "/lock/lxc/var/lib/lxc/";
+ char *pathname = RUNTIME_PATH "/lxc/lock/var/lib/lxc/";
ret = stat(pathname, &sb);
if (ret != 0) {
fprintf(stderr, "%d: filename %s not created\n", __LINE__, | CWE-59 | null | null |
35,885 | local unsigned long adler32_comb(unsigned long adler1, unsigned long adler2,
size_t len2)
{
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/* the derivation of this formula is left as an exercise for the reader */
rem = (unsigned)(len2 % BASE);
sum1 = adl... | Dir. Trav. | 0 | local unsigned long adler32_comb(unsigned long adler1, unsigned long adler2,
size_t len2)
{
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/* the derivation of this formula is left as an exercise for the reader */
rem = (unsigned)(len2 % BASE);
sum1 = adl... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,886 | local void append_len(struct job *job, size_t len)
{
struct space *lens;
assert(len < 539000896UL);
if (job->lens == NULL)
job->lens = get_space(&lens_pool);
lens = job->lens;
if (lens->size < lens->len + 3)
grow_space(lens);
if (len < 64)
lens->buf[lens->len++] = len + ... | Dir. Trav. | 0 | local void append_len(struct job *job, size_t len)
{
struct space *lens;
assert(len < 539000896UL);
if (job->lens == NULL)
job->lens = get_space(&lens_pool);
lens = job->lens;
if (lens->size < lens->len + 3)
grow_space(lens);
if (len < 64)
lens->buf[lens->len++] = len + ... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,887 | local int bail(char *why, char *what)
{
if (g.outd != -1 && g.outf != NULL)
unlink(g.outf);
complain("abort: %s%s", why, what);
exit(1);
return 0;
}
| Dir. Trav. | 0 | local int bail(char *why, char *what)
{
if (g.outd != -1 && g.outf != NULL)
unlink(g.outf);
complain("abort: %s%s", why, what);
exit(1);
return 0;
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,888 | local void cat(void)
{
/* write first magic byte (if we're here, there's at least one byte) */
writen(g.outd, &g.magic1, 1);
g.out_tot = 1;
/* copy the remainder of the input to the output (if there were any more
bytes of input, then g.in_left is non-zero and g.in_next is pointing to
the ... | Dir. Trav. | 0 | local void cat(void)
{
/* write first magic byte (if we're here, there's at least one byte) */
writen(g.outd, &g.magic1, 1);
g.out_tot = 1;
/* copy the remainder of the input to the output (if there were any more
bytes of input, then g.in_left is non-zero and g.in_next is pointing to
the ... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,889 | local int complain(char *fmt, ...)
{
va_list ap;
if (g.verbosity > 0) {
fprintf(stderr, "%s: ", g.prog);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
putc('\n', stderr);
fflush(stderr);
}
return 0;
}
| Dir. Trav. | 0 | local int complain(char *fmt, ...)
{
va_list ap;
if (g.verbosity > 0) {
fprintf(stderr, "%s: ", g.prog);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
putc('\n', stderr);
fflush(stderr);
}
return 0;
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,890 | local void compress_thread(void *dummy)
{
struct job *job; /* job pulled and working on */
struct job *here, **prior; /* pointers for inserting in write list */
unsigned long check; /* check value of input */
unsigned char *next; /* pointer for blocks, check val... | Dir. Trav. | 0 | local void compress_thread(void *dummy)
{
struct job *job; /* job pulled and working on */
struct job *here, **prior; /* pointers for inserting in write list */
unsigned long check; /* check value of input */
unsigned char *next; /* pointer for blocks, check val... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,891 | local size_t compressed_suffix(char *nm)
{
size_t len;
len = strlen(nm);
if (len > 4) {
nm += len - 4;
len = 4;
if (strcmp(nm, ".zip") == 0 || strcmp(nm, ".ZIP") == 0 ||
strcmp(nm, ".tgz") == 0)
return 4;
}
if (len > 3) {
nm += len - 3;
... | Dir. Trav. | 0 | local size_t compressed_suffix(char *nm)
{
size_t len;
len = strlen(nm);
if (len > 4) {
nm += len - 4;
len = 4;
if (strcmp(nm, ".zip") == 0 || strcmp(nm, ".ZIP") == 0 ||
strcmp(nm, ".tgz") == 0)
return 4;
}
if (len > 3) {
nm += len - 3;
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,892 | local unsigned long crc32_comb(unsigned long crc1, unsigned long crc2,
size_t len2)
{
int n;
unsigned long row;
unsigned long even[32]; /* even-power-of-two zeros operator */
unsigned long odd[32]; /* odd-power-of-two zeros operator */
/* degenerate case */
... | Dir. Trav. | 0 | local unsigned long crc32_comb(unsigned long crc1, unsigned long crc2,
size_t len2)
{
int n;
unsigned long row;
unsigned long even[32]; /* even-power-of-two zeros operator */
unsigned long odd[32]; /* odd-power-of-two zeros operator */
/* degenerate case */
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,893 | local void cut_short(int sig)
{
(void)sig;
Trace(("termination by user"));
if (g.outd != -1 && g.outf != NULL)
unlink(g.outf);
log_dump();
_exit(1);
}
| Dir. Trav. | 0 | local void cut_short(int sig)
{
(void)sig;
Trace(("termination by user"));
if (g.outd != -1 && g.outf != NULL)
unlink(g.outf);
log_dump();
_exit(1);
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,894 | local void defaults(void)
{
g.level = Z_DEFAULT_COMPRESSION;
/* default zopfli options as set by ZopfliInitOptions():
verbose = 0
numiterations = 15
blocksplitting = 1
blocksplittinglast = 0
blocksplittingmax = 15
*/
ZopfliInitOptions(&g.zopts);
#ifdef NOTHREAD
... | Dir. Trav. | 0 | local void defaults(void)
{
g.level = Z_DEFAULT_COMPRESSION;
/* default zopfli options as set by ZopfliInitOptions():
verbose = 0
numiterations = 15
blocksplitting = 1
blocksplittinglast = 0
blocksplittingmax = 15
*/
ZopfliInitOptions(&g.zopts);
#ifdef NOTHREAD
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,895 | local void finish_jobs(void)
{
struct job job;
int caught;
/* only do this once */
if (compress_have == NULL)
return;
/* command all of the extant compress threads to return */
possess(compress_have);
job.seq = -1;
job.next = NULL;
compress_head = &job;
compress_tail = ... | Dir. Trav. | 0 | local void finish_jobs(void)
{
struct job job;
int caught;
/* only do this once */
if (compress_have == NULL)
return;
/* command all of the extant compress threads to return */
possess(compress_have);
job.seq = -1;
job.next = NULL;
compress_head = &job;
compress_tail = ... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,896 | local int free_pool(struct pool *pool)
{
int count;
struct space *space;
possess(pool->have);
count = 0;
while ((space = pool->head) != NULL) {
pool->head = space->next;
FREE(space->buf);
free_lock(space->use);
FREE(space);
count++;
}
assert(count == ... | Dir. Trav. | 0 | local int free_pool(struct pool *pool)
{
int count;
struct space *space;
possess(pool->have);
count = 0;
while ((space = pool->head) != NULL) {
pool->head = space->next;
FREE(space->buf);
free_lock(space->use);
FREE(space);
count++;
}
assert(count == ... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,897 | local void free_track(struct mem_track_s *mem, void *ptr)
{
size_t size;
if (ptr != NULL) {
size = MALLOC_SIZE(ptr);
mem_track_grab(mem);
mem->num--;
mem->size -= size;
mem_track_drop(mem);
free(ptr);
}
}
| Dir. Trav. | 0 | local void free_track(struct mem_track_s *mem, void *ptr)
{
size_t size;
if (ptr != NULL) {
size = MALLOC_SIZE(ptr);
mem_track_grab(mem);
mem->num--;
mem->size -= size;
mem_track_drop(mem);
free(ptr);
}
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,898 | local int get_header(int save)
{
unsigned magic; /* magic header */
int method; /* compression method */
int flags; /* header flags */
unsigned fname, extra; /* name and extra field lengths */
unsigned tmp2; /* for macro */
unsigned ... | Dir. Trav. | 0 | local int get_header(int save)
{
unsigned magic; /* magic header */
int method; /* compression method */
int flags; /* header flags */
unsigned fname, extra; /* name and extra field lengths */
unsigned tmp2; /* for macro */
unsigned ... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,899 | local void gf2_matrix_square(unsigned long *square, unsigned long *mat)
{
int n;
for (n = 0; n < 32; n++)
square[n] = gf2_matrix_times(mat, mat[n]);
}
| Dir. Trav. | 0 | local void gf2_matrix_square(unsigned long *square, unsigned long *mat)
{
int n;
for (n = 0; n < 32; n++)
square[n] = gf2_matrix_times(mat, mat[n]);
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.