idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
14,300 | selftest_encr_2048 (gcry_sexp_t pkey, gcry_sexp_t skey)
{
const char *errtxt = NULL;
gcry_error_t err;
static const char plaintext[] =
"Jim quickly realized that the beautiful gowns are expensive.";
gcry_sexp_t plain = NULL;
gcry_sexp_t encr = NULL;
gcry_mpi_t ciphertext = NULL;
gcry_sexp_t decr = ... | null | 0 | selftest_encr_2048 (gcry_sexp_t pkey, gcry_sexp_t skey)
{
const char *errtxt = NULL;
gcry_error_t err;
static const char plaintext[] =
"Jim quickly realized that the beautiful gowns are expensive.";
gcry_sexp_t plain = NULL;
gcry_sexp_t encr = NULL;
gcry_mpi_t ciphertext = NULL;
gcry_sexp_t decr = ... | @@ -1019,16 +1019,37 @@ secret_core_crt (gcry_mpi_t M, gcry_mpi_t C,
gcry_mpi_t m1 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t m2 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t h = mpi_alloc_secure ( Nlimbs + 1 );
-
- /* m1 = c ^ (d mod (p-1)) mod p */
+ gcry_mpi_t D_blind = mpi_alloc_secure ( Nlimbs + 1 )... | CWE-310 | null | null |
14,301 | selftest_sign_2048 (gcry_sexp_t pkey, gcry_sexp_t skey)
{
static const char sample_data[] =
"(data (flags pkcs1)"
" (hash sha256 #11223344556677889900aabbccddeeff"
/**/ "102030405060708090a0b0c0d0f01121#))";
static const char sample_data_bad[] =
"(data (flags pkcs1)"
" (hash sha256 #11... | null | 0 | selftest_sign_2048 (gcry_sexp_t pkey, gcry_sexp_t skey)
{
static const char sample_data[] =
"(data (flags pkcs1)"
" (hash sha256 #11223344556677889900aabbccddeeff"
/**/ "102030405060708090a0b0c0d0f01121#))";
static const char sample_data_bad[] =
"(data (flags pkcs1)"
" (hash sha256 #11... | @@ -1019,16 +1019,37 @@ secret_core_crt (gcry_mpi_t M, gcry_mpi_t C,
gcry_mpi_t m1 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t m2 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t h = mpi_alloc_secure ( Nlimbs + 1 );
-
- /* m1 = c ^ (d mod (p-1)) mod p */
+ gcry_mpi_t D_blind = mpi_alloc_secure ( Nlimbs + 1 )... | CWE-310 | null | null |
14,302 | selftests_rsa (selftest_report_func_t report)
{
const char *what;
const char *errtxt;
gcry_error_t err;
gcry_sexp_t skey = NULL;
gcry_sexp_t pkey = NULL;
/* Convert the S-expressions into the internal representation. */
what = "convert";
err = sexp_sscan (&skey, NULL, sample_secret_key, strlen (sample... | null | 0 | selftests_rsa (selftest_report_func_t report)
{
const char *what;
const char *errtxt;
gcry_error_t err;
gcry_sexp_t skey = NULL;
gcry_sexp_t pkey = NULL;
/* Convert the S-expressions into the internal representation. */
what = "convert";
err = sexp_sscan (&skey, NULL, sample_secret_key, strlen (sample... | @@ -1019,16 +1019,37 @@ secret_core_crt (gcry_mpi_t M, gcry_mpi_t C,
gcry_mpi_t m1 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t m2 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t h = mpi_alloc_secure ( Nlimbs + 1 );
-
- /* m1 = c ^ (d mod (p-1)) mod p */
+ gcry_mpi_t D_blind = mpi_alloc_secure ( Nlimbs + 1 )... | CWE-310 | null | null |
14,303 | stronger_key_check ( RSA_secret_key *skey )
{
gcry_mpi_t t = mpi_alloc_secure ( 0 );
gcry_mpi_t t1 = mpi_alloc_secure ( 0 );
gcry_mpi_t t2 = mpi_alloc_secure ( 0 );
gcry_mpi_t phi = mpi_alloc_secure ( 0 );
/* check that n == p * q */
mpi_mul( t, skey->p, skey->q);
if (mpi_cmp( t, skey->n) )
log_info ... | null | 0 | stronger_key_check ( RSA_secret_key *skey )
{
gcry_mpi_t t = mpi_alloc_secure ( 0 );
gcry_mpi_t t1 = mpi_alloc_secure ( 0 );
gcry_mpi_t t2 = mpi_alloc_secure ( 0 );
gcry_mpi_t phi = mpi_alloc_secure ( 0 );
/* check that n == p * q */
mpi_mul( t, skey->p, skey->q);
if (mpi_cmp( t, skey->n) )
log_info ... | @@ -991,20 +991,64 @@ stronger_key_check ( RSA_secret_key *skey )
#endif
-
-/****************
- * Secret key operation. Encrypt INPUT with SKEY and put result into OUTPUT.
+\f
+/* Secret key operation - standard version.
*
* m = c^d mod n
- *
- * Or faster:
+ */
+static void
+secret_core_std (gcry_mpi_t M,... | CWE-310 | null | null |
14,304 | static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode)
{
int fd, ret;
/* FIXME: this should be handled with fchmodat(AT_SYMLINK_NOFOLLOW).
* Unfortunately, the linux kernel doesn't implement it yet. As an
* alternative, let's open the file and use fchmod() instead. This
* may fai... | null | 0 | static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode)
{
int fd, ret;
/* FIXME: this should be handled with fchmodat(AT_SYMLINK_NOFOLLOW).
* Unfortunately, the linux kernel doesn't implement it yet. As an
* alternative, let's open the file and use fchmod() instead. This
* may fai... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,305 | static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
{
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int ret = -1;
int dirfd;
dirfd = local_opendir_nofollow(fs_ctx, dirpath);
if (dirfd == -1) {
goto out;
}
... | null | 0 | static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
{
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int ret = -1;
int dirfd;
dirfd = local_opendir_nofollow(fs_ctx, dirpath);
if (dirfd == -1) {
goto out;
}
... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,306 | static int local_close(FsContext *ctx, V9fsFidOpenState *fs)
{
return close(fs->fd);
}
| null | 0 | static int local_close(FsContext *ctx, V9fsFidOpenState *fs)
{
return close(fs->fd);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,307 | static int local_closedir(FsContext *ctx, V9fsFidOpenState *fs)
{
return closedir(fs->dir.stream);
}
| null | 0 | static int local_closedir(FsContext *ctx, V9fsFidOpenState *fs)
{
return closedir(fs->dir.stream);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,308 | static FILE *local_fopenat(int dirfd, const char *name, const char *mode)
{
int fd, o_mode = 0;
FILE *fp;
int flags;
/*
* only supports two modes
*/
if (mode[0] == 'r') {
flags = O_RDONLY;
} else if (mode[0] == 'w') {
flags = O_WRONLY | O_TRUNC | O_CREAT;
o_mode... | null | 0 | static FILE *local_fopenat(int dirfd, const char *name, const char *mode)
{
int fd, o_mode = 0;
FILE *fp;
int flags;
/*
* only supports two modes
*/
if (mode[0] == 'r') {
flags = O_RDONLY;
} else if (mode[0] == 'w') {
flags = O_WRONLY | O_TRUNC | O_CREAT;
o_mode... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,309 | static int local_fstat(FsContext *fs_ctx, int fid_type,
V9fsFidOpenState *fs, struct stat *stbuf)
{
int err, fd;
if (fid_type == P9_FID_DIR) {
fd = dirfd(fs->dir.stream);
} else {
fd = fs->fd;
}
err = fstat(fd, stbuf);
if (err) {
return err;
}... | null | 0 | static int local_fstat(FsContext *fs_ctx, int fid_type,
V9fsFidOpenState *fs, struct stat *stbuf)
{
int err, fd;
if (fid_type == P9_FID_DIR) {
fd = dirfd(fs->dir.stream);
} else {
fd = fs->fd;
}
err = fstat(fd, stbuf);
if (err) {
return err;
}... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,310 | static int local_fsync(FsContext *ctx, int fid_type,
V9fsFidOpenState *fs, int datasync)
{
int fd;
if (fid_type == P9_FID_DIR) {
fd = dirfd(fs->dir.stream);
} else {
fd = fs->fd;
}
if (datasync) {
return qemu_fdatasync(fd);
} else {
return... | null | 0 | static int local_fsync(FsContext *ctx, int fid_type,
V9fsFidOpenState *fs, int datasync)
{
int fd;
if (fid_type == P9_FID_DIR) {
fd = dirfd(fs->dir.stream);
} else {
fd = fs->fd;
}
if (datasync) {
return qemu_fdatasync(fd);
} else {
return... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,311 | static ssize_t local_lgetxattr(FsContext *ctx, V9fsPath *fs_path,
const char *name, void *value, size_t size)
{
char *path = fs_path->data;
return v9fs_get_xattr(ctx, path, name, value, size);
}
| null | 0 | static ssize_t local_lgetxattr(FsContext *ctx, V9fsPath *fs_path,
const char *name, void *value, size_t size)
{
char *path = fs_path->data;
return v9fs_get_xattr(ctx, path, name, value, size);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,312 | static ssize_t local_llistxattr(FsContext *ctx, V9fsPath *fs_path,
void *value, size_t size)
{
char *path = fs_path->data;
return v9fs_list_xattr(ctx, path, value, size);
}
| null | 0 | static ssize_t local_llistxattr(FsContext *ctx, V9fsPath *fs_path,
void *value, size_t size)
{
char *path = fs_path->data;
return v9fs_list_xattr(ctx, path, value, size);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,313 | static int local_lremovexattr(FsContext *ctx, V9fsPath *fs_path,
const char *name)
{
char *path = fs_path->data;
return v9fs_remove_xattr(ctx, path, name);
}
| null | 0 | static int local_lremovexattr(FsContext *ctx, V9fsPath *fs_path,
const char *name)
{
char *path = fs_path->data;
return v9fs_remove_xattr(ctx, path, name);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,314 | static int local_lsetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name,
void *value, size_t size, int flags)
{
char *path = fs_path->data;
return v9fs_set_xattr(ctx, path, name, value, size, flags);
}
| null | 0 | static int local_lsetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name,
void *value, size_t size, int flags)
{
char *path = fs_path->data;
return v9fs_set_xattr(ctx, path, name, value, size, flags);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,315 | static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf)
{
int err = -1;
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int dirfd;
dirfd = local_opendir_nofollow(fs_ctx, dirpath);
if (dirfd == -1) {
goto out;
... | null | 0 | static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf)
{
int err = -1;
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int dirfd;
dirfd = local_opendir_nofollow(fs_ctx, dirpath);
if (dirfd == -1) {
goto out;
... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,316 | static void local_mapped_file_attr(int dirfd, const char *name,
struct stat *stbuf)
{
FILE *fp;
char buf[ATTR_MAX];
int map_dirfd;
map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR);
if (map_dirfd == -1) {
return;
}
fp = local_fopenat(map_dirfd, name,... | null | 0 | static void local_mapped_file_attr(int dirfd, const char *name,
struct stat *stbuf)
{
FILE *fp;
char buf[ATTR_MAX];
int map_dirfd;
map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR);
if (map_dirfd == -1) {
return;
}
fp = local_fopenat(map_dirfd, name,... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,317 | static int local_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
int fd;
fd = local_open_nofollow(ctx, fs_path->data, flags, 0);
if (fd == -1) {
return -1;
}
fs->fd = fd;
return fs->fd;
}
| null | 0 | static int local_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
int fd;
fd = local_open_nofollow(ctx, fs_path->data, flags, 0);
if (fd == -1) {
return -1;
}
fs->fd = fd;
return fs->fd;
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,318 | static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
int flags, FsCred *credp, V9fsFidOpenState *fs)
{
int fd = -1;
int err = -1;
int dirfd;
/*
* Mark all the open to not follow symlinks
*/
flags |= O_NOFOLLOW;
dirfd = local_opendir_n... | null | 0 | static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
int flags, FsCred *credp, V9fsFidOpenState *fs)
{
int fd = -1;
int err = -1;
int dirfd;
/*
* Mark all the open to not follow symlinks
*/
flags |= O_NOFOLLOW;
dirfd = local_opendir_n... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,319 | int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags,
mode_t mode)
{
LocalData *data = fs_ctx->private;
/* All paths are relative to the path data->mountfd points to */
while (*path == '/') {
path++;
}
return relative_openat_nofollow(data->mountfd,... | null | 0 | int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags,
mode_t mode)
{
LocalData *data = fs_ctx->private;
/* All paths are relative to the path data->mountfd points to */
while (*path == '/') {
path++;
}
return relative_openat_nofollow(data->mountfd,... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,320 | static int local_opendir(FsContext *ctx,
V9fsPath *fs_path, V9fsFidOpenState *fs)
{
int dirfd;
DIR *stream;
dirfd = local_opendir_nofollow(ctx, fs_path->data);
if (dirfd == -1) {
return -1;
}
stream = fdopendir(dirfd);
if (!stream) {
close(dirfd);
... | null | 0 | static int local_opendir(FsContext *ctx,
V9fsPath *fs_path, V9fsFidOpenState *fs)
{
int dirfd;
DIR *stream;
dirfd = local_opendir_nofollow(ctx, fs_path->data);
if (dirfd == -1) {
return -1;
}
stream = fdopendir(dirfd);
if (!stream) {
close(dirfd);
... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,321 | int local_opendir_nofollow(FsContext *fs_ctx, const char *path)
{
return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0);
}
| null | 0 | int local_opendir_nofollow(FsContext *fs_ctx, const char *path)
{
return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,322 | static ssize_t local_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
const struct iovec *iov,
int iovcnt, off_t offset)
{
ssize_t ret;
#ifdef CONFIG_PREADV
ret = pwritev(fs->fd, iov, iovcnt, offset);
#else
int err = lseek(fs->fd, offset, SEEK_SET);
... | null | 0 | static ssize_t local_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
const struct iovec *iov,
int iovcnt, off_t offset)
{
ssize_t ret;
#ifdef CONFIG_PREADV
ret = pwritev(fs->fd, iov, iovcnt, offset);
#else
int err = lseek(fs->fd, offset, SEEK_SET);
... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,323 | static struct dirent *local_readdir(FsContext *ctx, V9fsFidOpenState *fs)
{
struct dirent *entry;
again:
entry = readdir(fs->dir.stream);
if (!entry) {
return NULL;
}
if (ctx->export_flags & V9FS_SM_MAPPED) {
entry->d_type = DT_UNKNOWN;
} else if (ctx->export_flags & V9FS_SM_MA... | null | 0 | static struct dirent *local_readdir(FsContext *ctx, V9fsFidOpenState *fs)
{
struct dirent *entry;
again:
entry = readdir(fs->dir.stream);
if (!entry) {
return NULL;
}
if (ctx->export_flags & V9FS_SM_MAPPED) {
entry->d_type = DT_UNKNOWN;
} else if (ctx->export_flags & V9FS_SM_MA... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,324 | static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
char *buf, size_t bufsz)
{
ssize_t tsize = -1;
if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||
(fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {
int fd;
fd = local_open_nofollow(fs_ctx, fs_pa... | null | 0 | static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
char *buf, size_t bufsz)
{
ssize_t tsize = -1;
if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||
(fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {
int fd;
fd = local_open_nofollow(fs_ctx, fs_pa... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,325 | static int local_remove(FsContext *ctx, const char *path)
{
struct stat stbuf;
char *dirpath = g_path_get_dirname(path);
char *name = g_path_get_basename(path);
int flags = 0;
int dirfd;
int err = -1;
dirfd = local_opendir_nofollow(ctx, dirpath);
if (dirfd == -1) {
goto out;
... | null | 0 | static int local_remove(FsContext *ctx, const char *path)
{
struct stat stbuf;
char *dirpath = g_path_get_dirname(path);
char *name = g_path_get_basename(path);
int flags = 0;
int dirfd;
int err = -1;
dirfd = local_opendir_nofollow(ctx, dirpath);
if (dirfd == -1) {
goto out;
... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,326 | static void local_rewinddir(FsContext *ctx, V9fsFidOpenState *fs)
{
rewinddir(fs->dir.stream);
}
| null | 0 | static void local_rewinddir(FsContext *ctx, V9fsFidOpenState *fs)
{
rewinddir(fs->dir.stream);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,327 | static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
{
seekdir(fs->dir.stream, off);
}
| null | 0 | static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
{
seekdir(fs->dir.stream, off);
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,328 | static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd,
const char *name, FsCred *credp)
{
if (fchownat(dirfd, name, credp->fc_uid, credp->fc_gid,
AT_SYMLINK_NOFOLLOW) < 0) {
/*
* If we fail to change ownership and if we are
... | null | 0 | static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd,
const char *name, FsCred *credp)
{
if (fchownat(dirfd, name, credp->fc_uid, credp->fc_gid,
AT_SYMLINK_NOFOLLOW) < 0) {
/*
* If we fail to change ownership and if we are
... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,329 | static int local_set_mapped_file_attrat(int dirfd, const char *name,
FsCred *credp)
{
FILE *fp;
int ret;
char buf[ATTR_MAX];
int uid = -1, gid = -1, mode = -1, rdev = -1;
int map_dirfd;
ret = mkdirat(dirfd, VIRTFS_META_DIR, 0700);
if (ret < 0 && errno... | null | 0 | static int local_set_mapped_file_attrat(int dirfd, const char *name,
FsCred *credp)
{
FILE *fp;
int ret;
char buf[ATTR_MAX];
int uid = -1, gid = -1, mode = -1, rdev = -1;
int map_dirfd;
ret = mkdirat(dirfd, VIRTFS_META_DIR, 0700);
if (ret < 0 && errno... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,330 | static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
{
int fd, ret;
fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0);
if (fd == -1) {
return -1;
}
ret = fstatfs(fd, stbuf);
close_preserve_errno(fd);
return ret;
}
| null | 0 | static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
{
int fd, ret;
fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0);
if (fd == -1) {
return -1;
}
ret = fstatfs(fd, stbuf);
close_preserve_errno(fd);
return ret;
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,331 | static int local_symlink(FsContext *fs_ctx, const char *oldpath,
V9fsPath *dir_path, const char *name, FsCred *credp)
{
int err = -1;
int dirfd;
dirfd = local_opendir_nofollow(fs_ctx, dir_path->data);
if (dirfd == -1) {
return -1;
}
/* Determine the security mo... | null | 0 | static int local_symlink(FsContext *fs_ctx, const char *oldpath,
V9fsPath *dir_path, const char *name, FsCred *credp)
{
int err = -1;
int dirfd;
dirfd = local_opendir_nofollow(fs_ctx, dir_path->data);
if (dirfd == -1) {
return -1;
}
/* Determine the security mo... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,332 | static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size)
{
int fd, ret;
fd = local_open_nofollow(ctx, fs_path->data, O_WRONLY, 0);
if (fd == -1) {
return -1;
}
ret = ftruncate(fd, size);
close_preserve_errno(fd);
return ret;
}
| null | 0 | static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size)
{
int fd, ret;
fd = local_open_nofollow(ctx, fs_path->data, O_WRONLY, 0);
if (fd == -1) {
return -1;
}
ret = ftruncate(fd, size);
close_preserve_errno(fd);
return ret;
}
| @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,333 | static int local_utimensat(FsContext *s, V9fsPath *fs_path,
const struct timespec *buf)
{
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int dirfd, ret = -1;
dirfd = local_opendir_nofollow(s, dirpath);
if (dirfd == -1) ... | null | 0 | static int local_utimensat(FsContext *s, V9fsPath *fs_path,
const struct timespec *buf)
{
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int dirfd, ret = -1;
dirfd = local_opendir_nofollow(s, dirpath);
if (dirfd == -1) ... | @@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
{
if (dir_path) {
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
- } else {
+ } else if (strcmp(name, "/")) {
v9fs_path_sprintf(target, "%s", name);
+ } else {
+ /* We want the pat... | CWE-732 | null | null |
14,334 | void vnc_zrle_clear(VncState *vs)
{
if (vs->zrle.stream.opaque) {
deflateEnd(&vs->zrle.stream);
}
buffer_free(&vs->zrle.zrle);
buffer_free(&vs->zrle.fb);
buffer_free(&vs->zrle.zlib);
}
| null | 0 | void vnc_zrle_clear(VncState *vs)
{
if (vs->zrle.stream.opaque) {
deflateEnd(&vs->zrle.stream);
}
buffer_free(&vs->zrle.zrle);
buffer_free(&vs->zrle.fb);
buffer_free(&vs->zrle.zlib);
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,335 | int vnc_zrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
{
vs->zrle.type = VNC_ENCODING_ZRLE;
return zrle_send_framebuffer_update(vs, x, y, w, h);
}
| null | 0 | int vnc_zrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
{
vs->zrle.type = VNC_ENCODING_ZRLE;
return zrle_send_framebuffer_update(vs, x, y, w, h);
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,336 | static void vnc_zrle_start(VncState *vs)
{
buffer_reset(&vs->zrle.zrle);
/* make the output buffer be the zlib buffer, so we can compress it later */
vs->zrle.tmp = vs->output;
vs->output = vs->zrle.zrle;
}
| null | 0 | static void vnc_zrle_start(VncState *vs)
{
buffer_reset(&vs->zrle.zrle);
/* make the output buffer be the zlib buffer, so we can compress it later */
vs->zrle.tmp = vs->output;
vs->output = vs->zrle.zrle;
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,337 | static void vnc_zrle_stop(VncState *vs)
{
/* switch back to normal output/zlib buffers */
vs->zrle.zrle = vs->output;
vs->output = vs->zrle.tmp;
}
| null | 0 | static void vnc_zrle_stop(VncState *vs)
{
/* switch back to normal output/zlib buffers */
vs->zrle.zrle = vs->output;
vs->output = vs->zrle.tmp;
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,338 | int vnc_zywrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
{
vs->zrle.type = VNC_ENCODING_ZYWRLE;
return zrle_send_framebuffer_update(vs, x, y, w, h);
}
| null | 0 | int vnc_zywrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
{
vs->zrle.type = VNC_ENCODING_ZYWRLE;
return zrle_send_framebuffer_update(vs, x, y, w, h);
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,339 | static void zrle_choose_palette_rle(VncState *vs, int w, int h,
VncPalette *palette, int bpp_out,
int runs, int single_pixels,
int zywrle_level,
bool *use_rle, bool *use_palett... | null | 0 | static void zrle_choose_palette_rle(VncState *vs, int w, int h,
VncPalette *palette, int bpp_out,
int runs, int single_pixels,
int zywrle_level,
bool *use_rle, bool *use_palett... | @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,340 | static int zrle_compress_data(VncState *vs, int level)
{
z_streamp zstream = &vs->zrle.stream;
buffer_reset(&vs->zrle.zlib);
if (zstream->opaque != vs) {
int err;
zstream->zalloc = vnc_zlib_zalloc;
zstream->zfree = vnc_zlib_zfree;
err = deflateInit2(zstream, level, Z_DEFL... | null | 0 | static int zrle_compress_data(VncState *vs, int level)
{
z_streamp zstream = &vs->zrle.stream;
buffer_reset(&vs->zrle.zlib);
if (zstream->opaque != vs) {
int err;
zstream->zalloc = vnc_zlib_zalloc;
zstream->zfree = vnc_zlib_zfree;
err = deflateInit2(zstream, level, Z_DEFL... | @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,341 | static void *zrle_convert_fb(VncState *vs, int x, int y, int w, int h,
int bpp)
{
Buffer tmp;
buffer_reset(&vs->zrle.fb);
buffer_reserve(&vs->zrle.fb, w * h * bpp + bpp);
tmp = vs->output;
vs->output = vs->zrle.fb;
vnc_raw_send_framebuffer_update(vs, x, y, w, h);
... | null | 0 | static void *zrle_convert_fb(VncState *vs, int x, int y, int w, int h,
int bpp)
{
Buffer tmp;
buffer_reset(&vs->zrle.fb);
buffer_reserve(&vs->zrle.fb, w * h * bpp + bpp);
tmp = vs->output;
vs->output = vs->zrle.fb;
vnc_raw_send_framebuffer_update(vs, x, y, w, h);
... | @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,342 | static void zrle_write_u24a(VncState *vs, uint32_t value)
{
vnc_write(vs, (uint8_t *)&value, 3);
}
| null | 0 | static void zrle_write_u24a(VncState *vs, uint32_t value)
{
vnc_write(vs, (uint8_t *)&value, 3);
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,343 | static void zrle_write_u24b(VncState *vs, uint32_t value)
{
vnc_write(vs, ((uint8_t *)&value) + 1, 3);
}
| null | 0 | static void zrle_write_u24b(VncState *vs, uint32_t value)
{
vnc_write(vs, ((uint8_t *)&value) + 1, 3);
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,344 | static void zrle_write_u32(VncState *vs, uint32_t value)
{
vnc_write(vs, (uint8_t *)&value, 4);
}
| null | 0 | static void zrle_write_u32(VncState *vs, uint32_t value)
{
vnc_write(vs, (uint8_t *)&value, 4);
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,345 | static void zrle_write_u8(VncState *vs, uint8_t value)
{
vnc_write_u8(vs, value);
}
| null | 0 | static void zrle_write_u8(VncState *vs, uint8_t value)
{
vnc_write_u8(vs, value);
}
| @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value)
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
- bool be = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG);
+ bool be = vs->client_be;
size_t bytes;
in... | CWE-125 | null | null |
14,346 | static void vnc_async_encoding_end(VncState *orig, VncState *local)
{
orig->tight = local->tight;
orig->zlib = local->zlib;
orig->hextile = local->hextile;
orig->zrle = local->zrle;
orig->lossy_rect = local->lossy_rect;
queue->buffer = local->output;
}
| null | 0 | static void vnc_async_encoding_end(VncState *orig, VncState *local)
{
orig->tight = local->tight;
orig->zlib = local->zlib;
orig->hextile = local->hextile;
orig->zrle = local->zrle;
orig->lossy_rect = local->lossy_rect;
queue->buffer = local->output;
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,347 | bool vnc_has_job(VncState *vs)
{
bool ret;
vnc_lock_queue(queue);
ret = vnc_has_job_locked(vs);
vnc_unlock_queue(queue);
return ret;
}
| null | 0 | bool vnc_has_job(VncState *vs)
{
bool ret;
vnc_lock_queue(queue);
ret = vnc_has_job_locked(vs);
vnc_unlock_queue(queue);
return ret;
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,348 | static bool vnc_has_job_locked(VncState *vs)
{
VncJob *job;
QTAILQ_FOREACH(job, &queue->jobs, next) {
if (job->vs == vs || !vs) {
return true;
}
}
return false;
}
| null | 0 | static bool vnc_has_job_locked(VncState *vs)
{
VncJob *job;
QTAILQ_FOREACH(job, &queue->jobs, next) {
if (job->vs == vs || !vs) {
return true;
}
}
return false;
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,349 | VncJob *vnc_job_new(VncState *vs)
{
VncJob *job = g_malloc0(sizeof(VncJob));
job->vs = vs;
vnc_lock_queue(queue);
QLIST_INIT(&job->rectangles);
vnc_unlock_queue(queue);
return job;
}
| null | 0 | VncJob *vnc_job_new(VncState *vs)
{
VncJob *job = g_malloc0(sizeof(VncJob));
job->vs = vs;
vnc_lock_queue(queue);
QLIST_INIT(&job->rectangles);
vnc_unlock_queue(queue);
return job;
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,350 | void vnc_job_push(VncJob *job)
{
vnc_lock_queue(queue);
if (queue->exit || QLIST_EMPTY(&job->rectangles)) {
g_free(job);
} else {
QTAILQ_INSERT_TAIL(&queue->jobs, job, next);
qemu_cond_broadcast(&queue->cond);
}
vnc_unlock_queue(queue);
}
| null | 0 | void vnc_job_push(VncJob *job)
{
vnc_lock_queue(queue);
if (queue->exit || QLIST_EMPTY(&job->rectangles)) {
g_free(job);
} else {
QTAILQ_INSERT_TAIL(&queue->jobs, job, next);
qemu_cond_broadcast(&queue->cond);
}
vnc_unlock_queue(queue);
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,351 | void vnc_jobs_clear(VncState *vs)
{
VncJob *job, *tmp;
vnc_lock_queue(queue);
QTAILQ_FOREACH_SAFE(job, &queue->jobs, next, tmp) {
if (job->vs == vs || !vs) {
QTAILQ_REMOVE(&queue->jobs, job, next);
}
}
vnc_unlock_queue(queue);
}
| null | 0 | void vnc_jobs_clear(VncState *vs)
{
VncJob *job, *tmp;
vnc_lock_queue(queue);
QTAILQ_FOREACH_SAFE(job, &queue->jobs, next, tmp) {
if (job->vs == vs || !vs) {
QTAILQ_REMOVE(&queue->jobs, job, next);
}
}
vnc_unlock_queue(queue);
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,352 | void vnc_jobs_consume_buffer(VncState *vs)
{
bool flush;
vnc_lock_output(vs);
if (vs->jobs_buffer.offset) {
vnc_write(vs, vs->jobs_buffer.buffer, vs->jobs_buffer.offset);
buffer_reset(&vs->jobs_buffer);
}
flush = vs->csock != -1 && vs->abort != true;
vnc_unlock_output(vs);
... | null | 0 | void vnc_jobs_consume_buffer(VncState *vs)
{
bool flush;
vnc_lock_output(vs);
if (vs->jobs_buffer.offset) {
vnc_write(vs, vs->jobs_buffer.buffer, vs->jobs_buffer.offset);
buffer_reset(&vs->jobs_buffer);
}
flush = vs->csock != -1 && vs->abort != true;
vnc_unlock_output(vs);
... | @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,353 | void vnc_jobs_join(VncState *vs)
{
vnc_lock_queue(queue);
while (vnc_has_job_locked(vs)) {
qemu_cond_wait(&queue->cond, &queue->mutex);
}
vnc_unlock_queue(queue);
vnc_jobs_consume_buffer(vs);
}
| null | 0 | void vnc_jobs_join(VncState *vs)
{
vnc_lock_queue(queue);
while (vnc_has_job_locked(vs)) {
qemu_cond_wait(&queue->cond, &queue->mutex);
}
vnc_unlock_queue(queue);
vnc_jobs_consume_buffer(vs);
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,354 | static void vnc_lock_queue(VncJobQueue *queue)
{
qemu_mutex_lock(&queue->mutex);
}
| null | 0 | static void vnc_lock_queue(VncJobQueue *queue)
{
qemu_mutex_lock(&queue->mutex);
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,355 | static void vnc_queue_clear(VncJobQueue *q)
{
qemu_cond_destroy(&queue->cond);
qemu_mutex_destroy(&queue->mutex);
buffer_free(&queue->buffer);
g_free(q);
queue = NULL; /* Unset global queue */
}
| null | 0 | static void vnc_queue_clear(VncJobQueue *q)
{
qemu_cond_destroy(&queue->cond);
qemu_mutex_destroy(&queue->mutex);
buffer_free(&queue->buffer);
g_free(q);
queue = NULL; /* Unset global queue */
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,356 | static VncJobQueue *vnc_queue_init(void)
{
VncJobQueue *queue = g_malloc0(sizeof(VncJobQueue));
qemu_cond_init(&queue->cond);
qemu_mutex_init(&queue->mutex);
QTAILQ_INIT(&queue->jobs);
return queue;
}
| null | 0 | static VncJobQueue *vnc_queue_init(void)
{
VncJobQueue *queue = g_malloc0(sizeof(VncJobQueue));
qemu_cond_init(&queue->cond);
qemu_mutex_init(&queue->mutex);
QTAILQ_INIT(&queue->jobs);
return queue;
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,357 | void vnc_start_worker_thread(void)
{
VncJobQueue *q;
if (vnc_worker_thread_running())
return ;
q = vnc_queue_init();
qemu_thread_create(&q->thread, vnc_worker_thread, q, QEMU_THREAD_DETACHED);
queue = q; /* Set global queue */
}
| null | 0 | void vnc_start_worker_thread(void)
{
VncJobQueue *q;
if (vnc_worker_thread_running())
return ;
q = vnc_queue_init();
qemu_thread_create(&q->thread, vnc_worker_thread, q, QEMU_THREAD_DETACHED);
queue = q; /* Set global queue */
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,358 | static void *vnc_worker_thread(void *arg)
{
VncJobQueue *queue = arg;
qemu_thread_get_self(&queue->thread);
while (!vnc_worker_thread_loop(queue)) ;
vnc_queue_clear(queue);
return NULL;
}
| null | 0 | static void *vnc_worker_thread(void *arg)
{
VncJobQueue *queue = arg;
qemu_thread_get_self(&queue->thread);
while (!vnc_worker_thread_loop(queue)) ;
vnc_queue_clear(queue);
return NULL;
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,359 | static int vnc_worker_thread_loop(VncJobQueue *queue)
{
VncJob *job;
VncRectEntry *entry, *tmp;
VncState vs;
int n_rectangles;
int saved_offset;
vnc_lock_queue(queue);
while (QTAILQ_EMPTY(&queue->jobs) && !queue->exit) {
qemu_cond_wait(&queue->cond, &queue->mutex);
}
/* Here... | null | 0 | static int vnc_worker_thread_loop(VncJobQueue *queue)
{
VncJob *job;
VncRectEntry *entry, *tmp;
VncState vs;
int n_rectangles;
int saved_offset;
vnc_lock_queue(queue);
while (QTAILQ_EMPTY(&queue->jobs) && !queue->exit) {
qemu_cond_wait(&queue->cond, &queue->mutex);
}
/* Here... | @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,360 | bool vnc_worker_thread_running(void)
{
return queue; /* Check global queue */
}
| null | 0 | bool vnc_worker_thread_running(void)
{
return queue; /* Check global queue */
}
| @@ -187,7 +187,8 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
local->vd = orig->vd;
local->lossy_rect = orig->lossy_rect;
local->write_pixels = orig->write_pixels;
- local->clientds = orig->clientds;
+ local->client_pf = orig->client_pf;
+ local->client_be = orig->cli... | CWE-125 | null | null |
14,361 | static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
socklen_t salen)
{
char host[NI_MAXHOST];
char serv[NI_MAXSERV];
int err;
if ((err = getnameinfo((struct sockaddr *)sa, salen,
host, sizeof(host),
serv, s... | null | 0 | static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
socklen_t salen)
{
char host[NI_MAXHOST];
char serv[NI_MAXSERV];
int err;
if ((err = getnameinfo((struct sockaddr *)sa, salen,
host, sizeof(host),
serv, s... | @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,362 | VncInfo *qmp_query_vnc(Error **errp)
{
VncInfo *info = g_malloc0(sizeof(*info));
if (vnc_display == NULL || vnc_display->display == NULL) {
info->enabled = false;
} else {
VncClientInfoList *cur_item = NULL;
struct sockaddr_storage sa;
socklen_t salen = sizeof(sa);
c... | null | 0 | VncInfo *qmp_query_vnc(Error **errp)
{
VncInfo *info = g_malloc0(sizeof(*info));
if (vnc_display == NULL || vnc_display->display == NULL) {
info->enabled = false;
} else {
VncClientInfoList *cur_item = NULL;
struct sockaddr_storage sa;
socklen_t salen = sizeof(sa);
c... | @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,363 | static void vnc_client_cache_addr(VncState *client)
{
QDict *qdict;
qdict = qdict_new();
if (vnc_qdict_remote_addr(qdict, client->csock) < 0) {
QDECREF(qdict);
/* XXX: how to report the error? */
return;
}
client->info = QOBJECT(qdict);
}
| null | 0 | static void vnc_client_cache_addr(VncState *client)
{
QDict *qdict;
qdict = qdict_new();
if (vnc_qdict_remote_addr(qdict, client->csock) < 0) {
QDECREF(qdict);
/* XXX: how to report the error? */
return;
}
client->info = QOBJECT(qdict);
}
| @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,364 | static void vnc_client_cache_auth(VncState *client)
{
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
QDict *qdict;
#endif
if (!client->info) {
return;
}
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
qdict = qobject_to_qdict(client->info);
#endif
#ifdef CONFIG_VNC_TLS
if... | null | 0 | static void vnc_client_cache_auth(VncState *client)
{
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
QDict *qdict;
#endif
if (!client->info) {
return;
}
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
qdict = qobject_to_qdict(client->info);
#endif
#ifdef CONFIG_VNC_TLS
if... | @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,365 | static int vnc_qdict_remote_addr(QDict *qdict, int fd)
{
struct sockaddr_storage sa;
socklen_t salen;
salen = sizeof(sa);
if (getpeername(fd, (struct sockaddr*)&sa, &salen) < 0) {
return -1;
}
return put_addr_qdict(qdict, &sa, salen);
}
| null | 0 | static int vnc_qdict_remote_addr(QDict *qdict, int fd)
{
struct sockaddr_storage sa;
socklen_t salen;
salen = sizeof(sa);
if (getpeername(fd, (struct sockaddr*)&sa, &salen) < 0) {
return -1;
}
return put_addr_qdict(qdict, &sa, salen);
}
| @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,366 | static void vnc_qmp_event(VncState *vs, MonitorEvent event)
{
QDict *server;
QObject *data;
if (!vs->info) {
return;
}
server = qdict_new();
if (vnc_server_info_put(server) < 0) {
QDECREF(server);
return;
}
data = qobject_from_jsonf("{ 'client': %p, 'server': %... | null | 0 | static void vnc_qmp_event(VncState *vs, MonitorEvent event)
{
QDict *server;
QObject *data;
if (!vs->info) {
return;
}
server = qdict_new();
if (vnc_server_info_put(server) < 0) {
QDECREF(server);
return;
}
data = qobject_from_jsonf("{ 'client': %p, 'server': %... | @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,367 | static int vnc_server_addr_put(QDict *qdict, int fd)
{
struct sockaddr_storage sa;
socklen_t salen;
salen = sizeof(sa);
if (getsockname(fd, (struct sockaddr*)&sa, &salen) < 0) {
return -1;
}
return put_addr_qdict(qdict, &sa, salen);
}
| null | 0 | static int vnc_server_addr_put(QDict *qdict, int fd)
{
struct sockaddr_storage sa;
socklen_t salen;
salen = sizeof(sa);
if (getsockname(fd, (struct sockaddr*)&sa, &salen) < 0) {
return -1;
}
return put_addr_qdict(qdict, &sa, salen);
}
| @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,368 | static int vnc_server_info_put(QDict *qdict)
{
if (vnc_server_addr_put(qdict, vnc_display->lsock) < 0) {
return -1;
}
qdict_put(qdict, "auth", qstring_from_str(vnc_auth_name(vnc_display)));
return 0;
}
| null | 0 | static int vnc_server_info_put(QDict *qdict)
{
if (vnc_server_addr_put(qdict, vnc_display->lsock) < 0) {
return -1;
}
qdict_put(qdict, "auth", qstring_from_str(vnc_auth_name(vnc_display)));
return 0;
}
| @@ -436,6 +436,8 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
+ int width = ds_get_width(ds);
+ int height = ds_get_height(ds);
h += y;
@@ -446,10 +448,10 @@ static void vnc_dpy_update(Dis... | CWE-125 | null | null |
14,369 | XdmcpDecrementKey (XdmAuthKeyPtr key)
{
int i;
i = 7;
while (key->data[i]-- == 0)
if (--i < 0)
break;
}
| null | 0 | XdmcpDecrementKey (XdmAuthKeyPtr key)
{
int i;
i = 7;
while (key->data[i]-- == 0)
if (--i < 0)
break;
}
| @@ -62,10 +62,11 @@ getbits (long data, unsigned char *dst)
#define getpid(x) _getpid(x)
#endif
-void
-XdmcpGenerateKey (XdmAuthKeyPtr key)
-{
#ifndef HAVE_ARC4RANDOM_BUF
+
+static void
+emulate_getrandom_buf (char *auth, int len)
+{
long lowbits, highbits;
srandom ((int)getpid() ^ time((Time_t *)0)... | CWE-320 | null | null |
14,370 | getbits (long data, unsigned char *dst)
{
dst[0] = (data ) & 0xff;
dst[1] = (data >> 8) & 0xff;
dst[2] = (data >> 16) & 0xff;
dst[3] = (data >> 24) & 0xff;
}
| null | 0 | getbits (long data, unsigned char *dst)
{
dst[0] = (data ) & 0xff;
dst[1] = (data >> 8) & 0xff;
dst[2] = (data >> 16) & 0xff;
dst[3] = (data >> 24) & 0xff;
}
| @@ -62,10 +62,11 @@ getbits (long data, unsigned char *dst)
#define getpid(x) _getpid(x)
#endif
-void
-XdmcpGenerateKey (XdmAuthKeyPtr key)
-{
#ifndef HAVE_ARC4RANDOM_BUF
+
+static void
+emulate_getrandom_buf (char *auth, int len)
+{
long lowbits, highbits;
srandom ((int)getpid() ^ time((Time_t *)0)... | CWE-320 | null | null |
14,371 | intuit_diff_type (bool need_header, mode_t *p_file_type)
{
file_offset this_line = 0;
file_offset first_command_line = -1;
char first_ed_command_letter = 0;
lin fcl_line = 0; /* Pacify 'gcc -W'. */
bool this_is_a_command = false;
bool stars_this_line = false;
bool extended_headers = false;
... | Overflow | 0 | intuit_diff_type (bool need_header, mode_t *p_file_type)
{
file_offset this_line = 0;
file_offset first_command_line = -1;
char first_ed_command_letter = 0;
lin fcl_line = 0; /* Pacify 'gcc -W'. */
bool this_is_a_command = false;
bool stars_this_line = false;
bool extended_headers = false;
... | @@ -2276,7 +2276,7 @@ pfetch (lin line)
bool
pch_write_line (lin line, FILE *file)
{
- bool after_newline = p_line[line][p_len[line] - 1] == '\n';
+ bool after_newline = (p_len[line] > 0) && (p_line[line][p_len[line] - 1] == '\n');
if (! fwrite (p_line[line], sizeof (*p_line[line]), p_len[line], file))
wri... | CWE-119 | null | null |
14,372 | static int php_stream_memory_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
{
return FAILURE;
}
| null | 0 | static int php_stream_memory_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
{
return FAILURE;
}
| @@ -209,7 +209,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS
memset(ssb, 0, sizeof(php_stream_statbuf));
/* read-only across the board */
-
+
ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666;
ssb->sb.st_size = ms->fsize;
@... | CWE-20 | null | null |
14,373 | static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_DC)
{
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
assert(ms != NULL);
if (ms->data && close_handle && ms->mode != TEMP_STREAM_READONLY) {
efree(ms->data);
}
efree(ms);
return 0;
}
| null | 0 | static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_DC)
{
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
assert(ms != NULL);
if (ms->data && close_handle && ms->mode != TEMP_STREAM_READONLY) {
efree(ms->data);
}
efree(ms);
return 0;
}
| @@ -209,7 +209,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS
memset(ssb, 0, sizeof(php_stream_statbuf));
/* read-only across the board */
-
+
ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666;
ssb->sb.st_size = ms->fsize;
@... | CWE-20 | null | null |
14,374 | static int php_stream_memory_flush(php_stream *stream TSRMLS_DC)
{
/* nothing to do here */
return 0;
}
| null | 0 | static int php_stream_memory_flush(php_stream *stream TSRMLS_DC)
{
/* nothing to do here */
return 0;
}
| @@ -209,7 +209,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS
memset(ssb, 0, sizeof(php_stream_statbuf));
/* read-only across the board */
-
+
ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666;
ssb->sb.st_size = ms->fsize;
@... | CWE-20 | null | null |
14,375 | static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
{
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
assert(ms != NULL);
switch(whence) {
case SEEK_CUR:
if (offset < 0) {
if (ms->fpos < (size_t)(-offset)) {
ms->fpos = 0;
... | null | 0 | static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
{
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
assert(ms != NULL);
switch(whence) {
case SEEK_CUR:
if (offset < 0) {
if (ms->fpos < (size_t)(-offset)) {
ms->fpos = 0;
... | @@ -209,7 +209,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS
memset(ssb, 0, sizeof(php_stream_statbuf));
/* read-only across the board */
-
+
ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666;
ssb->sb.st_size = ms->fsize;
@... | CWE-20 | null | null |
14,376 | static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
assert(ms != NULL);
if (ms->mode & TEMP_STREAM_READONLY) {
return 0;
}
if (ms->fpos + count > ms->fsize) {
char *tmp;
if (!ms->data) {... | null | 0 | static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
assert(ms != NULL);
if (ms->mode & TEMP_STREAM_READONLY) {
return 0;
}
if (ms->fpos + count > ms->fsize) {
char *tmp;
if (!ms->data) {... | @@ -209,7 +209,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS
memset(ssb, 0, sizeof(php_stream_statbuf));
/* read-only across the board */
-
+
ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666;
ssb->sb.st_size = ms->fsize;
@... | CWE-20 | null | null |
14,377 | static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract;
assert(ts != NULL);
if (!ts->innerstream) {
return -1;
}
if (php_stream_is(ts->innerstream, PHP_STREAM_IS_MEMORY)) {
size_t memsize;
char *me... | null | 0 | static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract;
assert(ts != NULL);
if (!ts->innerstream) {
return -1;
}
if (php_stream_is(ts->innerstream, PHP_STREAM_IS_MEMORY)) {
size_t memsize;
char *me... | @@ -209,7 +209,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS
memset(ssb, 0, sizeof(php_stream_statbuf));
/* read-only across the board */
-
+
ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666;
ssb->sb.st_size = ms->fsize;
@... | CWE-20 | null | null |
14,378 | choose_comp(struct sshcomp *comp, char *client, char *server)
{
char *name = match_list(client, server, NULL);
if (name == NULL)
return SSH_ERR_NO_COMPRESS_ALG_MATCH;
if (strcmp(name, "zlib@openssh.com") == 0) {
comp->type = COMP_DELAYED;
} else if (strcmp(name, "zlib") == 0) {
comp->type = COMP_ZLIB;
} els... | DoS | 0 | choose_comp(struct sshcomp *comp, char *client, char *server)
{
char *name = match_list(client, server, NULL);
if (name == NULL)
return SSH_ERR_NO_COMPRESS_ALG_MATCH;
if (strcmp(name, "zlib@openssh.com") == 0) {
comp->type = COMP_DELAYED;
} else if (strcmp(name, "zlib") == 0) {
comp->type = COMP_ZLIB;
} els... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,379 | choose_enc(struct sshenc *enc, char *client, char *server)
{
char *name = match_list(client, server, NULL);
if (name == NULL)
return SSH_ERR_NO_CIPHER_ALG_MATCH;
if ((enc->cipher = cipher_by_name(name)) == NULL)
return SSH_ERR_INTERNAL_ERROR;
enc->name = name;
enc->enabled = 0;
enc->iv = NULL;
enc->iv_len =... | DoS | 0 | choose_enc(struct sshenc *enc, char *client, char *server)
{
char *name = match_list(client, server, NULL);
if (name == NULL)
return SSH_ERR_NO_CIPHER_ALG_MATCH;
if ((enc->cipher = cipher_by_name(name)) == NULL)
return SSH_ERR_INTERNAL_ERROR;
enc->name = name;
enc->enabled = 0;
enc->iv = NULL;
enc->iv_len =... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,380 | choose_kex(struct kex *k, char *client, char *server)
{
const struct kexalg *kexalg;
k->name = match_list(client, server, NULL);
debug("kex: algorithm: %s", k->name ? k->name : "(no match)");
if (k->name == NULL)
return SSH_ERR_NO_KEX_ALG_MATCH;
if ((kexalg = kex_alg_by_name(k->name)) == NULL)
return SSH_ERR... | DoS | 0 | choose_kex(struct kex *k, char *client, char *server)
{
const struct kexalg *kexalg;
k->name = match_list(client, server, NULL);
debug("kex: algorithm: %s", k->name ? k->name : "(no match)");
if (k->name == NULL)
return SSH_ERR_NO_KEX_ALG_MATCH;
if ((kexalg = kex_alg_by_name(k->name)) == NULL)
return SSH_ERR... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,381 | choose_mac(struct ssh *ssh, struct sshmac *mac, char *client, char *server)
{
char *name = match_list(client, server, NULL);
if (name == NULL)
return SSH_ERR_NO_MAC_ALG_MATCH;
if (mac_setup(mac, name) < 0)
return SSH_ERR_INTERNAL_ERROR;
/* truncate the key */
if (ssh->compat & SSH_BUG_HMAC)
mac->key_len = 1... | DoS | 0 | choose_mac(struct ssh *ssh, struct sshmac *mac, char *client, char *server)
{
char *name = match_list(client, server, NULL);
if (name == NULL)
return SSH_ERR_NO_MAC_ALG_MATCH;
if (mac_setup(mac, name) < 0)
return SSH_ERR_INTERNAL_ERROR;
/* truncate the key */
if (ssh->compat & SSH_BUG_HMAC)
mac->key_len = 1... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,382 | derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen,
const struct sshbuf *shared_secret, u_char **keyp)
{
struct kex *kex = ssh->kex;
struct ssh_digest_ctx *hashctx = NULL;
char c = id;
u_int have;
size_t mdsz;
u_char *digest;
int r;
if ((mdsz = ssh_digest_bytes(kex->hash_alg)) == 0... | DoS | 0 | derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen,
const struct sshbuf *shared_secret, u_char **keyp)
{
struct kex *kex = ssh->kex;
struct ssh_digest_ctx *hashctx = NULL;
char c = id;
u_int have;
size_t mdsz;
u_char *digest;
int r;
if ((mdsz = ssh_digest_bytes(kex->hash_alg)) == 0... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,383 | derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus,
u_int8_t cookie[8], u_int8_t id[16])
{
u_int8_t hbuf[2048], sbuf[2048], obuf[SSH_DIGEST_MAX_LENGTH];
struct ssh_digest_ctx *hashctx = NULL;
size_t hlen, slen;
int r;
hlen = BN_num_bytes(host_modulus);
slen = BN_num_bytes(server_modulus);
i... | DoS | 0 | derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus,
u_int8_t cookie[8], u_int8_t id[16])
{
u_int8_t hbuf[2048], sbuf[2048], obuf[SSH_DIGEST_MAX_LENGTH];
struct ssh_digest_ctx *hashctx = NULL;
size_t hlen, slen;
int r;
hlen = BN_num_bytes(host_modulus);
slen = BN_num_bytes(server_modulus);
i... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,384 | dump_digest(char *msg, u_char *digest, int len)
{
fprintf(stderr, "%s\n", msg);
sshbuf_dump_data(digest, len, stderr);
}
| DoS | 0 | dump_digest(char *msg, u_char *digest, int len)
{
fprintf(stderr, "%s\n", msg);
sshbuf_dump_data(digest, len, stderr);
}
| @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,385 | kex_alg_list(char sep)
{
char *ret = NULL, *tmp;
size_t nlen, rlen = 0;
const struct kexalg *k;
for (k = kexalgs; k->name != NULL; k++) {
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(k->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy... | DoS | 0 | kex_alg_list(char sep)
{
char *ret = NULL, *tmp;
size_t nlen, rlen = 0;
const struct kexalg *k;
for (k = kexalgs; k->name != NULL; k++) {
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(k->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,386 | kex_assemble_names(const char *def, char **list)
{
char *ret;
if (list == NULL || *list == NULL || **list == '\0') {
*list = strdup(def);
return 0;
}
if (**list != '+') {
return 0;
}
if ((ret = kex_names_cat(def, *list + 1)) == NULL)
return SSH_ERR_ALLOC_FAIL;
free(*list);
*list = ret;
return 0;
}
| DoS | 0 | kex_assemble_names(const char *def, char **list)
{
char *ret;
if (list == NULL || *list == NULL || **list == '\0') {
*list = strdup(def);
return 0;
}
if (**list != '+') {
return 0;
}
if ((ret = kex_names_cat(def, *list + 1)) == NULL)
return SSH_ERR_ALLOC_FAIL;
free(*list);
*list = ret;
return 0;
}
| @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,387 | kex_buf2prop(struct sshbuf *raw, int *first_kex_follows, char ***propp)
{
struct sshbuf *b = NULL;
u_char v;
u_int i;
char **proposal = NULL;
int r;
*propp = NULL;
if ((proposal = calloc(PROPOSAL_MAX, sizeof(char *))) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((b = sshbuf_fromb(raw)) == NULL) {
r = SSH_ERR_AL... | DoS | 0 | kex_buf2prop(struct sshbuf *raw, int *first_kex_follows, char ***propp)
{
struct sshbuf *b = NULL;
u_char v;
u_int i;
char **proposal = NULL;
int r;
*propp = NULL;
if ((proposal = calloc(PROPOSAL_MAX, sizeof(char *))) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((b = sshbuf_fromb(raw)) == NULL) {
r = SSH_ERR_AL... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,388 | kex_choose_conf(struct ssh *ssh)
{
struct kex *kex = ssh->kex;
struct newkeys *newkeys;
char **my = NULL, **peer = NULL;
char **cprop, **sprop;
int nenc, nmac, ncomp;
u_int mode, ctos, need, dh_need, authlen;
int r, first_kex_follows;
debug2("local %s KEXINIT proposal", kex->server ? "server" : "client");
if ... | DoS | 0 | kex_choose_conf(struct ssh *ssh)
{
struct kex *kex = ssh->kex;
struct newkeys *newkeys;
char **my = NULL, **peer = NULL;
char **cprop, **sprop;
int nenc, nmac, ncomp;
u_int mode, ctos, need, dh_need, authlen;
int r, first_kex_follows;
debug2("local %s KEXINIT proposal", kex->server ? "server" : "client");
if ... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,389 | kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen,
const struct sshbuf *shared_secret)
{
struct kex *kex = ssh->kex;
u_char *keys[NKEYS];
u_int i, j, mode, ctos;
int r;
for (i = 0; i < NKEYS; i++) {
if ((r = derive_key(ssh, 'A'+i, kex->we_need, hash, hashlen,
shared_secret, &keys[i])) != 0)... | DoS | 0 | kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen,
const struct sshbuf *shared_secret)
{
struct kex *kex = ssh->kex;
u_char *keys[NKEYS];
u_int i, j, mode, ctos;
int r;
for (i = 0; i < NKEYS; i++) {
if ((r = derive_key(ssh, 'A'+i, kex->we_need, hash, hashlen,
shared_secret, &keys[i])) != 0)... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,390 | kex_derive_keys_bn(struct ssh *ssh, u_char *hash, u_int hashlen,
const BIGNUM *secret)
{
struct sshbuf *shared_secret;
int r;
if ((shared_secret = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshbuf_put_bignum2(shared_secret, secret)) == 0)
r = kex_derive_keys(ssh, hash, hashlen, shared_secre... | DoS | 0 | kex_derive_keys_bn(struct ssh *ssh, u_char *hash, u_int hashlen,
const BIGNUM *secret)
{
struct sshbuf *shared_secret;
int r;
if ((shared_secret = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((r = sshbuf_put_bignum2(shared_secret, secret)) == 0)
r = kex_derive_keys(ssh, hash, hashlen, shared_secre... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,391 | kex_free_newkeys(struct newkeys *newkeys)
{
if (newkeys == NULL)
return;
if (newkeys->enc.key) {
explicit_bzero(newkeys->enc.key, newkeys->enc.key_len);
free(newkeys->enc.key);
newkeys->enc.key = NULL;
}
if (newkeys->enc.iv) {
explicit_bzero(newkeys->enc.iv, newkeys->enc.iv_len);
free(newkeys->enc.iv);
... | DoS | 0 | kex_free_newkeys(struct newkeys *newkeys)
{
if (newkeys == NULL)
return;
if (newkeys->enc.key) {
explicit_bzero(newkeys->enc.key, newkeys->enc.key_len);
free(newkeys->enc.key);
newkeys->enc.key = NULL;
}
if (newkeys->enc.iv) {
explicit_bzero(newkeys->enc.iv, newkeys->enc.iv_len);
free(newkeys->enc.iv);
... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,392 | kex_input_ext_info(int type, u_int32_t seq, void *ctxt)
{
struct ssh *ssh = ctxt;
struct kex *kex = ssh->kex;
u_int32_t i, ninfo;
char *name, *val, *found;
int r;
debug("SSH2_MSG_EXT_INFO received");
ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &kex_protocol_error);
if ((r = sshpkt_get_u32(ssh, &ninfo)) != 0)
re... | DoS | 0 | kex_input_ext_info(int type, u_int32_t seq, void *ctxt)
{
struct ssh *ssh = ctxt;
struct kex *kex = ssh->kex;
u_int32_t i, ninfo;
char *name, *val, *found;
int r;
debug("SSH2_MSG_EXT_INFO received");
ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &kex_protocol_error);
if ((r = sshpkt_get_u32(ssh, &ninfo)) != 0)
re... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,393 | kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
{
struct ssh *ssh = ctxt;
struct kex *kex = ssh->kex;
const u_char *ptr;
u_int i;
size_t dlen;
int r;
debug("SSH2_MSG_KEXINIT received");
if (kex == NULL)
return SSH_ERR_INVALID_ARGUMENT;
ptr = sshpkt_ptr(ssh, &dlen);
if ((r = sshbuf_put(kex->peer, pt... | DoS | 0 | kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
{
struct ssh *ssh = ctxt;
struct kex *kex = ssh->kex;
const u_char *ptr;
u_int i;
size_t dlen;
int r;
debug("SSH2_MSG_KEXINIT received");
if (kex == NULL)
return SSH_ERR_INVALID_ARGUMENT;
ptr = sshpkt_ptr(ssh, &dlen);
if ((r = sshbuf_put(kex->peer, pt... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,394 | kex_names_valid(const char *names)
{
char *s, *cp, *p;
if (names == NULL || strcmp(names, "") == 0)
return 0;
if ((s = cp = strdup(names)) == NULL)
return 0;
for ((p = strsep(&cp, ",")); p && *p != '\0';
(p = strsep(&cp, ","))) {
if (kex_alg_by_name(p) == NULL) {
error("Unsupported KEX algorithm \"%.... | DoS | 0 | kex_names_valid(const char *names)
{
char *s, *cp, *p;
if (names == NULL || strcmp(names, "") == 0)
return 0;
if ((s = cp = strdup(names)) == NULL)
return 0;
for ((p = strsep(&cp, ",")); p && *p != '\0';
(p = strsep(&cp, ","))) {
if (kex_alg_by_name(p) == NULL) {
error("Unsupported KEX algorithm \"%.... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,395 | kex_new(struct ssh *ssh, char *proposal[PROPOSAL_MAX], struct kex **kexp)
{
struct kex *kex;
int r;
*kexp = NULL;
if ((kex = calloc(1, sizeof(*kex))) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((kex->peer = sshbuf_new()) == NULL ||
(kex->my = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
i... | DoS | 0 | kex_new(struct ssh *ssh, char *proposal[PROPOSAL_MAX], struct kex **kexp)
{
struct kex *kex;
int r;
*kexp = NULL;
if ((kex = calloc(1, sizeof(*kex))) == NULL)
return SSH_ERR_ALLOC_FAIL;
if ((kex->peer = sshbuf_new()) == NULL ||
(kex->my = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
}
i... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,396 | kex_prop2buf(struct sshbuf *b, char *proposal[PROPOSAL_MAX])
{
u_int i;
int r;
sshbuf_reset(b);
/*
* add a dummy cookie, the cookie will be overwritten by
* kex_send_kexinit(), each time a kexinit is set
*/
for (i = 0; i < KEX_COOKIE_LEN; i++) {
if ((r = sshbuf_put_u8(b, 0)) != 0)
return r;
}
for (i... | DoS | 0 | kex_prop2buf(struct sshbuf *b, char *proposal[PROPOSAL_MAX])
{
u_int i;
int r;
sshbuf_reset(b);
/*
* add a dummy cookie, the cookie will be overwritten by
* kex_send_kexinit(), each time a kexinit is set
*/
for (i = 0; i < KEX_COOKIE_LEN; i++) {
if ((r = sshbuf_put_u8(b, 0)) != 0)
return r;
}
for (i... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,397 | kex_prop_free(char **proposal)
{
u_int i;
if (proposal == NULL)
return;
for (i = 0; i < PROPOSAL_MAX; i++)
free(proposal[i]);
free(proposal);
}
| DoS | 0 | kex_prop_free(char **proposal)
{
u_int i;
if (proposal == NULL)
return;
for (i = 0; i < PROPOSAL_MAX; i++)
free(proposal[i]);
free(proposal);
}
| @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,398 | kex_protocol_error(int type, u_int32_t seq, void *ctxt)
{
struct ssh *ssh = active_state; /* XXX */
int r;
error("kex protocol error: type %d seq %u", type, seq);
if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 ||
(r = sshpkt_put_u32(ssh, seq)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
return r;
r... | DoS | 0 | kex_protocol_error(int type, u_int32_t seq, void *ctxt)
{
struct ssh *ssh = active_state; /* XXX */
int r;
error("kex protocol error: type %d seq %u", type, seq);
if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 ||
(r = sshpkt_put_u32(ssh, seq)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
return r;
r... | @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
14,399 | kex_reset_dispatch(struct ssh *ssh)
{
ssh_dispatch_range(ssh, SSH2_MSG_TRANSPORT_MIN,
SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error);
ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit);
}
| DoS | 0 | kex_reset_dispatch(struct ssh *ssh)
{
ssh_dispatch_range(ssh, SSH2_MSG_TRANSPORT_MIN,
SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error);
ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit);
}
| @@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
ssh_dispatch_set(ssh, SSH2_M... | CWE-476 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.