idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
1,100 | _XcursorThemeInherits (const char *full)
{
char line[8192];
char *result = NULL;
FILE *f;
if (!full)
return NULL;
f = fopen (full, "r");
if (f)
{
while (fgets (line, sizeof (line), f))
{
if (!strncmp (line, "Inherits", 8))
{
char *l = line + 8;
char *... | Overflow | 0 | _XcursorThemeInherits (const char *full)
{
char line[8192];
char *result = NULL;
FILE *f;
if (!full)
return NULL;
f = fopen (full, "r");
if (f)
{
while (fgets (line, sizeof (line), f))
{
if (!strncmp (line, "Inherits", 8))
{
char *l = line + 8;
char *... | @@ -202,6 +202,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height *... | CWE-190 | null | null |
1,101 | load_all_cursors_from_dir(const char *path, int size,
void (*load_callback)(XcursorImages *, void *),
void *user_data)
{
FILE *f;
DIR *dir = opendir(path);
struct dirent *ent;
char *full;
XcursorImages *images;
if (!dir)
return;
for(ent = readdir(dir); ent; ent = readdir(dir)) {
#ifdef _DIRENT_HAVE... | Overflow | 0 | load_all_cursors_from_dir(const char *path, int size,
void (*load_callback)(XcursorImages *, void *),
void *user_data)
{
FILE *f;
DIR *dir = opendir(path);
struct dirent *ent;
char *full;
XcursorImages *images;
if (!dir)
return;
for(ent = readdir(dir); ent; ent = readdir(dir)) {
#ifdef _DIRENT_HAVE... | @@ -202,6 +202,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height *... | CWE-190 | null | null |
1,102 | xcursor_load_theme(const char *theme, int size,
void (*load_callback)(XcursorImages *, void *),
void *user_data)
{
char *full, *dir;
char *inherits = NULL;
const char *path, *i;
if (!theme)
theme = "default";
for (path = XcursorLibraryPath();
path;
path = _XcursorNextPath(path)) {
dir... | Overflow | 0 | xcursor_load_theme(const char *theme, int size,
void (*load_callback)(XcursorImages *, void *),
void *user_data)
{
char *full, *dir;
char *inherits = NULL;
const char *path, *i;
if (!theme)
theme = "default";
for (path = XcursorLibraryPath();
path;
path = _XcursorNextPath(path)) {
dir... | @@ -202,6 +202,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height *... | CWE-190 | null | null |
1,103 | XcursorFileLoad (FILE *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
{
XcursorFile f;
if (!file || !commentsp || !imagesp)
return XcursorFalse;
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileLoad (&f, commentsp, imagesp);
}
| Overflow | 0 | XcursorFileLoad (FILE *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
{
XcursorFile f;
if (!file || !commentsp || !imagesp)
return XcursorFalse;
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileLoad (&f, commentsp, imagesp);
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,104 | XcursorFileLoadAllImages (FILE *file)
{
XcursorFile f;
if (!file)
return NULL;
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileLoadAllImages (&f);
}
| Overflow | 0 | XcursorFileLoadAllImages (FILE *file)
{
XcursorFile f;
if (!file)
return NULL;
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileLoadAllImages (&f);
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,105 | XcursorFileLoadImage (FILE *file, int size)
{
XcursorFile f;
if (!file)
return NULL;
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileLoadImage (&f, size);
}
| Overflow | 0 | XcursorFileLoadImage (FILE *file, int size)
{
XcursorFile f;
if (!file)
return NULL;
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileLoadImage (&f, size);
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,106 | XcursorFilenameLoad (const char *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
{
FILE *f;
XcursorBool ret;
if (!file)
return XcursorFalse;
f = fopen (file, "r");
if (!f)
return 0;
ret = XcursorFileLoad (f, commentsp, imagesp);
fclose (f);
r... | Overflow | 0 | XcursorFilenameLoad (const char *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
{
FILE *f;
XcursorBool ret;
if (!file)
return XcursorFalse;
f = fopen (file, "r");
if (!f)
return 0;
ret = XcursorFileLoad (f, commentsp, imagesp);
fclose (f);
r... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,107 | XcursorFilenameLoadAllImages (const char *file)
{
FILE *f;
XcursorImages *images;
if (!file)
return NULL;
f = fopen (file, "r");
if (!f)
return NULL;
images = XcursorFileLoadAllImages (f);
fclose (f);
return images;
}
| Overflow | 0 | XcursorFilenameLoadAllImages (const char *file)
{
FILE *f;
XcursorImages *images;
if (!file)
return NULL;
f = fopen (file, "r");
if (!f)
return NULL;
images = XcursorFileLoadAllImages (f);
fclose (f);
return images;
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,108 | XcursorFilenameLoadImage (const char *file, int size)
{
FILE *f;
XcursorImage *image;
if (!file || size < 0)
return NULL;
f = fopen (file, "r");
if (!f)
return NULL;
image = XcursorFileLoadImage (f, size);
fclose (f);
return image;
}
| Overflow | 0 | XcursorFilenameLoadImage (const char *file, int size)
{
FILE *f;
XcursorImage *image;
if (!file || size < 0)
return NULL;
f = fopen (file, "r");
if (!f)
return NULL;
image = XcursorFileLoadImage (f, size);
fclose (f);
return image;
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,109 | XcursorFilenameLoadImages (const char *file, int size)
{
FILE *f;
XcursorImages *images;
if (!file || size < 0)
return NULL;
f = fopen (file, "r");
if (!f)
return NULL;
images = XcursorFileLoadImages (f, size);
fclose (f);
return images;
}
| Overflow | 0 | XcursorFilenameLoadImages (const char *file, int size)
{
FILE *f;
XcursorImages *images;
if (!file || size < 0)
return NULL;
f = fopen (file, "r");
if (!f)
return NULL;
images = XcursorFileLoadImages (f, size);
fclose (f);
return images;
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,110 | XcursorFilenameSave (const char *file,
const XcursorComments *comments,
const XcursorImages *images)
{
FILE *f;
XcursorBool ret;
if (!file || !comments || !images)
return XcursorFalse;
f = fopen (file, "w");
if (!f)
return 0;
ret = XcursorFileSave (f, co... | Overflow | 0 | XcursorFilenameSave (const char *file,
const XcursorComments *comments,
const XcursorImages *images)
{
FILE *f;
XcursorBool ret;
if (!file || !comments || !images)
return XcursorFalse;
f = fopen (file, "w");
if (!f)
return 0;
ret = XcursorFileSave (f, co... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,111 | XcursorFilenameSaveImages (const char *file, const XcursorImages *images)
{
FILE *f;
XcursorBool ret;
if (!file || !images)
return XcursorFalse;
f = fopen (file, "w");
if (!f)
return 0;
ret = XcursorFileSaveImages (f, images);
return fclose (f) != EOF && ret;
}
| Overflow | 0 | XcursorFilenameSaveImages (const char *file, const XcursorImages *images)
{
FILE *f;
XcursorBool ret;
if (!file || !images)
return XcursorFalse;
f = fopen (file, "w");
if (!f)
return 0;
ret = XcursorFileSaveImages (f, images);
return fclose (f) != EOF && ret;
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,112 | XcursorImagesSetName (XcursorImages *images, const char *name)
{
char *new;
if (!images || !name)
return;
new = strdup (name);
if (!new)
return;
if (images->name)
free (images->name);
images->name = new;
}
| Overflow | 0 | XcursorImagesSetName (XcursorImages *images, const char *name)
{
char *new;
if (!images || !name)
return;
new = strdup (name);
if (!new)
return;
if (images->name)
free (images->name);
images->name = new;
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,113 | XcursorXcFileLoad (XcursorFile *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
{
XcursorFileHeader *fileHeader;
int nimage;
int ncomment;
XcursorImages *images;
XcursorImage *image;
XcursorComment *comment;
XcursorComments *comments;
int toc;
if ... | Overflow | 0 | XcursorXcFileLoad (XcursorFile *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
{
XcursorFileHeader *fileHeader;
int nimage;
int ncomment;
XcursorImages *images;
XcursorImage *image;
XcursorComment *comment;
XcursorComments *comments;
int toc;
if ... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,114 | XcursorXcFileLoadAllImages (XcursorFile *file)
{
XcursorFileHeader *fileHeader;
XcursorImage *image;
XcursorImages *images;
int nimage;
int n;
int toc;
if (!file)
return NULL;
fileHeader = _XcursorReadFileHeader (file);
if (!fileHeader)
return NULL;
nimage = 0;
... | Overflow | 0 | XcursorXcFileLoadAllImages (XcursorFile *file)
{
XcursorFileHeader *fileHeader;
XcursorImage *image;
XcursorImages *images;
int nimage;
int n;
int toc;
if (!file)
return NULL;
fileHeader = _XcursorReadFileHeader (file);
if (!fileHeader)
return NULL;
nimage = 0;
... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,115 | XcursorXcFileSave (XcursorFile *file,
const XcursorComments *comments,
const XcursorImages *images)
{
XcursorFileHeader *fileHeader;
XcursorUInt position;
int n;
int toc;
if (!file || !comments || !images)
return XcursorFalse;
fileHeader = _XcursorFileHeaderC... | Overflow | 0 | XcursorXcFileSave (XcursorFile *file,
const XcursorComments *comments,
const XcursorImages *images)
{
XcursorFileHeader *fileHeader;
XcursorUInt position;
int n;
int toc;
if (!file || !comments || !images)
return XcursorFalse;
fileHeader = _XcursorFileHeaderC... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,116 | _XcursorCommentLength (XcursorComment *comment)
{
return XCURSOR_COMMENT_HEADER_LEN + strlen (comment->comment);
}
| Overflow | 0 | _XcursorCommentLength (XcursorComment *comment)
{
return XCURSOR_COMMENT_HEADER_LEN + strlen (comment->comment);
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,117 | _XcursorImageLength (XcursorImage *image)
{
if (!image)
return 0;
return XCURSOR_IMAGE_HEADER_LEN + (image->width * image->height) * 4;
}
| Overflow | 0 | _XcursorImageLength (XcursorImage *image)
{
if (!image)
return 0;
return XCURSOR_IMAGE_HEADER_LEN + (image->width * image->height) * 4;
}
| @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,118 | _XcursorReadComment (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
XcursorChunkHeader chunkHeader;
XcursorUInt length;
XcursorComment *comment;
if (!file || !fileHeader)
return NULL;
/* read chunk header */
if (!_XcursorFileReadChunkHeader (fi... | Overflow | 0 | _XcursorReadComment (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
XcursorChunkHeader chunkHeader;
XcursorUInt length;
XcursorComment *comment;
if (!file || !fileHeader)
return NULL;
/* read chunk header */
if (!_XcursorFileReadChunkHeader (fi... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,119 | _XcursorWriteComment (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc,
XcursorComment *comment)
{
XcursorChunkHeader chunkHeader;
XcursorUInt length;
if (!file || !fileHeader || !comment || !comment->comment)
return XcursorFalse;
length = str... | Overflow | 0 | _XcursorWriteComment (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc,
XcursorComment *comment)
{
XcursorChunkHeader chunkHeader;
XcursorUInt length;
if (!file || !fileHeader || !comment || !comment->comment)
return XcursorFalse;
length = str... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,120 | _XcursorWriteImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc,
XcursorImage *image)
{
XcursorChunkHeader chunkHeader;
int n;
XcursorPixel *p;
if (!file || !fileHeader || !image)
return XcursorFalse;
/* sanity check data */
if (image->width > XCURS... | Overflow | 0 | _XcursorWriteImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc,
XcursorImage *image)
{
XcursorChunkHeader chunkHeader;
int n;
XcursorPixel *p;
if (!file || !fileHeader || !image)
return XcursorFalse;
/* sanity check data */
if (image->width > XCURS... | @@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
{
XcursorImage *image;
+ if (width < 0 || height < 0)
+ return NULL;
+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
+ return NULL;
+
image = malloc (sizeof (XcursorImage) +
width * height * s... | CWE-190 | null | null |
1,121 | void cache_tmp_xattr(struct file_struct *file, stat_x *sxp)
{
int ndx;
if (!sxp->xattr)
return;
if (prior_xattr_count == (size_t)-1)
prior_xattr_count = rsync_xal_l.count;
ndx = find_matching_xattr(sxp->xattr);
if (ndx < 0)
rsync_xal_store(sxp->xattr); /* adds item to rsync_xal_l */
F_XATTR(file) = ndx;
... | DoS | 0 | void cache_tmp_xattr(struct file_struct *file, stat_x *sxp)
{
int ndx;
if (!sxp->xattr)
return;
if (prior_xattr_count == (size_t)-1)
prior_xattr_count = rsync_xal_l.count;
ndx = find_matching_xattr(sxp->xattr);
if (ndx < 0)
rsync_xal_store(sxp->xattr); /* adds item to rsync_xal_l */
F_XATTR(file) = ndx;
... | @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,122 | int copy_xattrs(const char *source, const char *dest)
{
ssize_t list_len, name_len;
size_t datum_len;
char *name, *ptr;
#ifdef HAVE_LINUX_XATTRS
int user_only = am_sender ? 0 : am_root <= 0;
#endif
/* This puts the name list into the "namebuf" buffer. */
if ((list_len = get_xattr_names(source)) < 0)
return -1;... | DoS | 0 | int copy_xattrs(const char *source, const char *dest)
{
ssize_t list_len, name_len;
size_t datum_len;
char *name, *ptr;
#ifdef HAVE_LINUX_XATTRS
int user_only = am_sender ? 0 : am_root <= 0;
#endif
/* This puts the name list into the "namebuf" buffer. */
if ((list_len = get_xattr_names(source)) < 0)
return -1;... | @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,123 | int del_def_xattr_acl(const char *fname)
{
return sys_lremovexattr(fname, XDEF_ACL_ATTR);
}
| DoS | 0 | int del_def_xattr_acl(const char *fname)
{
return sys_lremovexattr(fname, XDEF_ACL_ATTR);
}
| @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,124 | void free_xattr(stat_x *sxp)
{
if (!sxp->xattr)
return;
rsync_xal_free(sxp->xattr);
free(sxp->xattr);
sxp->xattr = NULL;
}
| DoS | 0 | void free_xattr(stat_x *sxp)
{
if (!sxp->xattr)
return;
rsync_xal_free(sxp->xattr);
free(sxp->xattr);
sxp->xattr = NULL;
}
| @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,125 | int get_stat_xattr(const char *fname, int fd, STRUCT_STAT *fst, STRUCT_STAT *xst)
{
int mode, rdev_major, rdev_minor, uid, gid, len;
char buf[256];
if (am_root >= 0 || IS_DEVICE(fst->st_mode) || IS_SPECIAL(fst->st_mode))
return -1;
if (xst)
*xst = *fst;
else
xst = fst;
if (fname) {
fd = -1;
len = sys_... | DoS | 0 | int get_stat_xattr(const char *fname, int fd, STRUCT_STAT *fst, STRUCT_STAT *xst)
{
int mode, rdev_major, rdev_minor, uid, gid, len;
char buf[256];
if (am_root >= 0 || IS_DEVICE(fst->st_mode) || IS_SPECIAL(fst->st_mode))
return -1;
if (xst)
*xst = *fst;
else
xst = fst;
if (fname) {
fd = -1;
len = sys_... | @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,126 | int get_xattr(const char *fname, stat_x *sxp)
{
sxp->xattr = new(item_list);
*sxp->xattr = empty_xattr;
if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
/* Everyone supports this. */
} else if (S_ISLNK(sxp->st.st_mode)) {
#ifndef NO_SYMLINK_XATTRS
if (!preserve_links)
#endif
return 0;
} else if ... | DoS | 0 | int get_xattr(const char *fname, stat_x *sxp)
{
sxp->xattr = new(item_list);
*sxp->xattr = empty_xattr;
if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
/* Everyone supports this. */
} else if (S_ISLNK(sxp->st.st_mode)) {
#ifndef NO_SYMLINK_XATTRS
if (!preserve_links)
#endif
return 0;
} else if ... | @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,127 | char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p)
{
const char *name = is_access_acl ? XACC_ACL_ATTR : XDEF_ACL_ATTR;
*len_p = 0; /* no extra data alloc needed from get_xattr_data() */
return get_xattr_data(fname, name, len_p, 1);
}
| DoS | 0 | char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p)
{
const char *name = is_access_acl ? XACC_ACL_ATTR : XDEF_ACL_ATTR;
*len_p = 0; /* no extra data alloc needed from get_xattr_data() */
return get_xattr_data(fname, name, len_p, 1);
}
| @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,128 | static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr,
int no_missing_error)
{
size_t datum_len = sys_lgetxattr(fname, name, NULL, 0);
size_t extra_len = *len_ptr;
char *ptr;
*len_ptr = datum_len;
if (datum_len == (size_t)-1) {
if (errno == ENOTSUP || no_missing_error)
retu... | DoS | 0 | static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr,
int no_missing_error)
{
size_t datum_len = sys_lgetxattr(fname, name, NULL, 0);
size_t extra_len = *len_ptr;
char *ptr;
*len_ptr = datum_len;
if (datum_len == (size_t)-1) {
if (errno == ENOTSUP || no_missing_error)
retu... | @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,129 | static ssize_t get_xattr_names(const char *fname)
{
ssize_t list_len;
int64 arg;
if (!namebuf) {
namebuf_len = 1024;
namebuf = new_array(char, namebuf_len);
if (!namebuf)
out_of_memory("get_xattr_names");
}
while (1) {
/* The length returned includes all the '\0' terminators. */
list_len = sys_llist... | DoS | 0 | static ssize_t get_xattr_names(const char *fname)
{
ssize_t list_len;
int64 arg;
if (!namebuf) {
namebuf_len = 1024;
namebuf = new_array(char, namebuf_len);
if (!namebuf)
out_of_memory("get_xattr_names");
}
while (1) {
/* The length returned includes all the '\0' terminators. */
list_len = sys_llist... | @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf... | CWE-125 | null | null |
1,130 | static bool BB_isspace(CHAR_T c) { return ((unsigned)c < 256 && isspace(c)); }
| Exec Code | 0 | static bool BB_isspace(CHAR_T c) { return ((unsigned)c < 256 && isspace(c)); }
| @@ -645,6 +645,18 @@ static void free_tab_completion_data(void)
static void add_match(char *matched)
{
+ unsigned char *p = (unsigned char*)matched;
+ while (*p) {
+ /* ESC attack fix: drop any string with control chars */
+ if (*p < ' '
+ || (!ENABLE_UNICODE_SUPPORT && *p >= 0x7f)
+ || (ENABLE_UNICODE_SUPPOR... | CWE-94 | null | null |
1,131 | void ct2msg(const struct nf_conntrack *ct, struct nethdr *n)
{
uint8_t l4proto = nfct_get_attr_u8(ct, ATTR_L4PROTO);
if (nfct_attr_grp_is_set(ct, ATTR_GRP_ORIG_IPV4)) {
ct_build_group(ct, ATTR_GRP_ORIG_IPV4, n, NTA_IPV4,
sizeof(struct nfct_attr_grp_ipv4));
} else if (nfct_attr_grp_is_set(ct, ATTR_GRP_OR... | DoS | 0 | void ct2msg(const struct nf_conntrack *ct, struct nethdr *n)
{
uint8_t l4proto = nfct_get_attr_u8(ct, ATTR_L4PROTO);
if (nfct_attr_grp_is_set(ct, ATTR_GRP_ORIG_IPV4)) {
ct_build_group(ct, ATTR_GRP_ORIG_IPV4, n, NTA_IPV4,
sizeof(struct nfct_attr_grp_ipv4));
} else if (nfct_attr_grp_is_set(ct, ATTR_GRP_OR... | @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,132 | static void ct_build_clabel(const struct nf_conntrack *ct, struct nethdr *n)
{
const struct nfct_bitmask *b;
uint32_t *words;
unsigned int wordcount, i, maxbit;
if (!nfct_attr_is_set(ct, ATTR_CONNLABELS))
return;
b = nfct_get_attr(ct, ATTR_CONNLABELS);
maxbit = nfct_bitmask_maxbit(b);
for (i=0; i <= maxbit;... | DoS | 0 | static void ct_build_clabel(const struct nf_conntrack *ct, struct nethdr *n)
{
const struct nfct_bitmask *b;
uint32_t *words;
unsigned int wordcount, i, maxbit;
if (!nfct_attr_is_set(ct, ATTR_CONNLABELS))
return;
b = nfct_get_attr(ct, ATTR_CONNLABELS);
maxbit = nfct_bitmask_maxbit(b);
for (i=0; i <= maxbit;... | @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,133 | ct_build_group(const struct nf_conntrack *ct, int a, struct nethdr *n,
int b, int size)
{
void *ptr = put_header(n, b, size);
nfct_get_attr_grp(ct, a, ptr);
}
| DoS | 0 | ct_build_group(const struct nf_conntrack *ct, int a, struct nethdr *n,
int b, int size)
{
void *ptr = put_header(n, b, size);
nfct_get_attr_grp(ct, a, ptr);
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,134 | ct_build_natseqadj(const struct nf_conntrack *ct, struct nethdr *n)
{
struct nta_attr_natseqadj data = {
.orig_seq_correction_pos =
htonl(nfct_get_attr_u32(ct, ATTR_ORIG_NAT_SEQ_CORRECTION_POS)),
.orig_seq_offset_before =
htonl(nfct_get_attr_u32(ct, ATTR_ORIG_NAT_SEQ_OFFSET_BEFORE)),
.orig_seq_offset_after ... | DoS | 0 | ct_build_natseqadj(const struct nf_conntrack *ct, struct nethdr *n)
{
struct nta_attr_natseqadj data = {
.orig_seq_correction_pos =
htonl(nfct_get_attr_u32(ct, ATTR_ORIG_NAT_SEQ_CORRECTION_POS)),
.orig_seq_offset_before =
htonl(nfct_get_attr_u32(ct, ATTR_ORIG_NAT_SEQ_OFFSET_BEFORE)),
.orig_seq_offset_after ... | @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,135 | ct_build_str(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
{
const char *data = nfct_get_attr(ct, a);
addattr(n, b, data, strlen(data)+1);
}
| DoS | 0 | ct_build_str(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
{
const char *data = nfct_get_attr(ct, a);
addattr(n, b, data, strlen(data)+1);
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,136 | ct_build_u16(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
{
uint16_t data = nfct_get_attr_u16(ct, a);
data = htons(data);
addattr(n, b, &data, sizeof(uint16_t));
}
| DoS | 0 | ct_build_u16(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
{
uint16_t data = nfct_get_attr_u16(ct, a);
data = htons(data);
addattr(n, b, &data, sizeof(uint16_t));
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,137 | ct_build_u8(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
{
void *ptr = put_header(n, b, sizeof(uint8_t));
memcpy(ptr, nfct_get_attr(ct, a), sizeof(uint8_t));
}
| DoS | 0 | ct_build_u8(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
{
void *ptr = put_header(n, b, sizeof(uint8_t));
memcpy(ptr, nfct_get_attr(ct, a), sizeof(uint8_t));
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,138 | void exp2msg(const struct nf_expect *exp, struct nethdr *n)
{
const struct nf_conntrack *ct = nfexp_get_attr(exp, ATTR_EXP_MASTER);
uint8_t l4proto = nfct_get_attr_u8(ct, ATTR_L4PROTO);
/* master conntrack for this expectation. */
if (nfct_attr_grp_is_set(ct, ATTR_GRP_ORIG_IPV4)) {
ct_build_group(ct, ATTR_GRP_OR... | DoS | 0 | void exp2msg(const struct nf_expect *exp, struct nethdr *n)
{
const struct nf_conntrack *ct = nfexp_get_attr(exp, ATTR_EXP_MASTER);
uint8_t l4proto = nfct_get_attr_u8(ct, ATTR_L4PROTO);
/* master conntrack for this expectation. */
if (nfct_attr_grp_is_set(ct, ATTR_GRP_ORIG_IPV4)) {
ct_build_group(ct, ATTR_GRP_OR... | @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,139 | exp_build_l4proto_dccp(const struct nf_conntrack *ct, struct nethdr *n, int a)
{
ct_build_group(ct, ATTR_GRP_ORIG_PORT, n, a,
sizeof(struct nfct_attr_grp_port));
}
| DoS | 0 | exp_build_l4proto_dccp(const struct nf_conntrack *ct, struct nethdr *n, int a)
{
ct_build_group(ct, ATTR_GRP_ORIG_PORT, n, a,
sizeof(struct nfct_attr_grp_port));
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,140 | exp_build_l4proto_tcp(const struct nf_conntrack *ct, struct nethdr *n, int a)
{
ct_build_group(ct, ATTR_GRP_ORIG_PORT, n, a,
sizeof(struct nfct_attr_grp_port));
}
| DoS | 0 | exp_build_l4proto_tcp(const struct nf_conntrack *ct, struct nethdr *n, int a)
{
ct_build_group(ct, ATTR_GRP_ORIG_PORT, n, a,
sizeof(struct nfct_attr_grp_port));
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,141 | exp_build_l4proto_udp(const struct nf_conntrack *ct, struct nethdr *n, int a)
{
ct_build_group(ct, ATTR_GRP_ORIG_PORT, n, a,
sizeof(struct nfct_attr_grp_port));
}
| DoS | 0 | exp_build_l4proto_udp(const struct nf_conntrack *ct, struct nethdr *n, int a)
{
ct_build_group(ct, ATTR_GRP_ORIG_PORT, n, a,
sizeof(struct nfct_attr_grp_port));
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,142 | exp_build_str(const struct nf_expect *exp, int a, struct nethdr *n, int b)
{
const char *data = nfexp_get_attr(exp, a);
addattr(n, b, data, strlen(data)+1);
}
| DoS | 0 | exp_build_str(const struct nf_expect *exp, int a, struct nethdr *n, int b)
{
const char *data = nfexp_get_attr(exp, a);
addattr(n, b, data, strlen(data)+1);
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,143 | exp_build_u32(const struct nf_expect *exp, int a, struct nethdr *n, int b)
{
uint32_t data = nfexp_get_attr_u32(exp, a);
data = htonl(data);
addattr(n, b, &data, sizeof(uint32_t));
}
| DoS | 0 | exp_build_u32(const struct nf_expect *exp, int a, struct nethdr *n, int b)
{
uint32_t data = nfexp_get_attr_u32(exp, a);
data = htonl(data);
addattr(n, b, &data, sizeof(uint32_t));
}
| @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,144 | put_header(struct nethdr *n, int attr, size_t len)
{
struct netattr *nta = NETHDR_TAIL(n);
int total_size = NTA_ALIGN(NTA_LENGTH(len));
int attr_size = NTA_LENGTH(len);
n->len += total_size;
nta->nta_attr = htons(attr);
nta->nta_len = htons(attr_size);
memset((unsigned char *)nta + attr_size, 0, total_size - att... | DoS | 0 | put_header(struct nethdr *n, int attr, size_t len)
{
struct netattr *nta = NETHDR_TAIL(n);
int total_size = NTA_ALIGN(NTA_LENGTH(len));
int attr_size = NTA_LENGTH(len);
n->len += total_size;
nta->nta_attr = htons(attr);
nta->nta_len = htons(attr_size);
memset((unsigned char *)nta + attr_size, 0, total_size - att... | @@ -105,14 +105,14 @@ static enum nf_conntrack_attr nat_type[] =
ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS,
ATTR_REPL_NAT_SEQ_OFFSET_BEFORE, ATTR_REPL_NAT_SEQ_OFFSET_AFTER };
+/* ICMP, UDP and TCP are always loaded with nf_conntrack_ipv4 */
static void build_l4proto_tcp(const struct nf... | CWE-17 | null | null |
1,145 | static V9fsFidState *alloc_fid(V9fsState *s, int32_t fid)
{
V9fsFidState *f;
for (f = s->fid_list; f; f = f->next) {
/* If fid is already there return NULL */
BUG_ON(f->clunked);
if (f->fid == fid) {
return NULL;
}
}
f = g_malloc0(sizeof(V9fsFidState));
f... | DoS | 0 | static V9fsFidState *alloc_fid(V9fsState *s, int32_t fid)
{
V9fsFidState *f;
for (f = s->fid_list; f; f = f->next) {
/* If fid is already there return NULL */
BUG_ON(f->clunked);
if (f->fid == fid) {
return NULL;
}
}
f = g_malloc0(sizeof(V9fsFidState));
f... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,146 | void cred_init(FsCred *credp)
{
credp->fc_uid = -1;
credp->fc_gid = -1;
credp->fc_mode = -1;
credp->fc_rdev = -1;
}
| DoS | 0 | void cred_init(FsCred *credp)
{
credp->fc_uid = -1;
credp->fc_gid = -1;
credp->fc_mode = -1;
credp->fc_rdev = -1;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,147 | static int dotl_to_open_flags(int flags)
{
int i;
/*
* We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY
* and P9_DOTL_NOACCESS
*/
int oflags = flags & O_ACCMODE;
DotlOpenflagMap dotl_oflag_map[] = {
{ P9_DOTL_CREATE, O_CREAT },
{ P9_DOTL_EXCL, O_EXCL },
{ P9... | DoS | 0 | static int dotl_to_open_flags(int flags)
{
int i;
/*
* We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY
* and P9_DOTL_NOACCESS
*/
int oflags = flags & O_ACCMODE;
DotlOpenflagMap dotl_oflag_map[] = {
{ P9_DOTL_CREATE, O_CREAT },
{ P9_DOTL_EXCL, O_EXCL },
{ P9... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,148 | static int coroutine_fn fid_to_qid(V9fsPDU *pdu, V9fsFidState *fidp,
V9fsQID *qidp)
{
struct stat stbuf;
int err;
err = v9fs_co_lstat(pdu, &fidp->path, &stbuf);
if (err < 0) {
return err;
}
stat_to_qid(&stbuf, qidp);
return 0;
}
| DoS | 0 | static int coroutine_fn fid_to_qid(V9fsPDU *pdu, V9fsFidState *fidp,
V9fsQID *qidp)
{
struct stat stbuf;
int err;
err = v9fs_co_lstat(pdu, &fidp->path, &stbuf);
if (err < 0) {
return err;
}
stat_to_qid(&stbuf, qidp);
return 0;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,149 | static int coroutine_fn free_fid(V9fsPDU *pdu, V9fsFidState *fidp)
{
int retval = 0;
if (fidp->fid_type == P9_FID_FILE) {
/* If we reclaimed the fd no need to close */
if (fidp->fs.fd != -1) {
retval = v9fs_co_close(pdu, &fidp->fs);
}
} else if (fidp->fid_type == P9_FID_... | DoS | 0 | static int coroutine_fn free_fid(V9fsPDU *pdu, V9fsFidState *fidp)
{
int retval = 0;
if (fidp->fid_type == P9_FID_FILE) {
/* If we reclaimed the fd no need to close */
if (fidp->fs.fd != -1) {
retval = v9fs_co_close(pdu, &fidp->fs);
}
} else if (fidp->fid_type == P9_FID_... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,150 | static int get_dotl_openflags(V9fsState *s, int oflags)
{
int flags;
/*
* Filter the client open flags
*/
flags = dotl_to_open_flags(oflags);
flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT);
/*
* Ignore direct disk access hint until the server supports it.
*/
flags &= ~O_DIRECT;
... | DoS | 0 | static int get_dotl_openflags(V9fsState *s, int oflags)
{
int flags;
/*
* Filter the client open flags
*/
flags = dotl_to_open_flags(oflags);
flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT);
/*
* Ignore direct disk access hint until the server supports it.
*/
flags &= ~O_DIRECT;
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,151 | static V9fsFidState *coroutine_fn get_fid(V9fsPDU *pdu, int32_t fid)
{
int err;
V9fsFidState *f;
V9fsState *s = pdu->s;
for (f = s->fid_list; f; f = f->next) {
BUG_ON(f->clunked);
if (f->fid == fid) {
/*
* Update the fid ref upfront so that
* we don... | DoS | 0 | static V9fsFidState *coroutine_fn get_fid(V9fsPDU *pdu, int32_t fid)
{
int err;
V9fsFidState *f;
V9fsState *s = pdu->s;
for (f = s->fid_list; f; f = f->next) {
BUG_ON(f->clunked);
if (f->fid == fid) {
/*
* Update the fid ref upfront so that
* we don... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,152 | static inline bool is_ro_export(FsContext *ctx)
{
return ctx->export_flags & V9FS_RDONLY;
}
| DoS | 0 | static inline bool is_ro_export(FsContext *ctx)
{
return ctx->export_flags & V9FS_RDONLY;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,153 | static bool name_is_illegal(const char *name)
{
return !*name || strchr(name, '/') != NULL;
}
| DoS | 0 | static bool name_is_illegal(const char *name)
{
return !*name || strchr(name, '/') != NULL;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,154 | static bool not_same_qid(const V9fsQID *qid1, const V9fsQID *qid2)
{
return
qid1->type != qid2->type ||
qid1->version != qid2->version ||
qid1->path != qid2->path;
}
| DoS | 0 | static bool not_same_qid(const V9fsQID *qid1, const V9fsQID *qid2)
{
return
qid1->type != qid2->type ||
qid1->version != qid2->version ||
qid1->path != qid2->path;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,155 | void pdu_free(V9fsPDU *pdu)
{
V9fsState *s = pdu->s;
g_assert(!pdu->cancelled);
QLIST_REMOVE(pdu, next);
QLIST_INSERT_HEAD(&s->free_list, pdu, next);
}
| DoS | 0 | void pdu_free(V9fsPDU *pdu)
{
V9fsState *s = pdu->s;
g_assert(!pdu->cancelled);
QLIST_REMOVE(pdu, next);
QLIST_INSERT_HEAD(&s->free_list, pdu, next);
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,156 | static ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
{
ssize_t ret;
va_list ap;
va_start(ap, fmt);
ret = pdu->s->transport->pdu_vmarshal(pdu, offset, fmt, ap);
va_end(ap);
return ret;
}
| DoS | 0 | static ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
{
ssize_t ret;
va_list ap;
va_start(ap, fmt);
ret = pdu->s->transport->pdu_vmarshal(pdu, offset, fmt, ap);
va_end(ap);
return ret;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,157 | static ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
{
ssize_t ret;
va_list ap;
va_start(ap, fmt);
ret = pdu->s->transport->pdu_vunmarshal(pdu, offset, fmt, ap);
va_end(ap);
return ret;
}
| DoS | 0 | static ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
{
ssize_t ret;
va_list ap;
va_start(ap, fmt);
ret = pdu->s->transport->pdu_vunmarshal(pdu, offset, fmt, ap);
va_end(ap);
return ret;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,158 | static void print_sg(struct iovec *sg, int cnt)
{
int i;
printf("sg[%d]: {", cnt);
for (i = 0; i < cnt; i++) {
if (i) {
printf(", ");
}
printf("(%p, %zd)", sg[i].iov_base, sg[i].iov_len);
}
printf("}\n");
}
| DoS | 0 | static void print_sg(struct iovec *sg, int cnt)
{
int i;
printf("sg[%d]: {", cnt);
for (i = 0; i < cnt; i++) {
if (i) {
printf(", ");
}
printf("(%p, %zd)", sg[i].iov_base, sg[i].iov_len);
}
printf("}\n");
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,159 | static int coroutine_fn put_fid(V9fsPDU *pdu, V9fsFidState *fidp)
{
BUG_ON(!fidp->ref);
fidp->ref--;
/*
* Don't free the fid if it is in reclaim list
*/
if (!fidp->ref && fidp->clunked) {
if (fidp->fid == pdu->s->root_fid) {
/*
* if the clunked fid is root fid ... | DoS | 0 | static int coroutine_fn put_fid(V9fsPDU *pdu, V9fsFidState *fidp)
{
BUG_ON(!fidp->ref);
fidp->ref--;
/*
* Don't free the fid if it is in reclaim list
*/
if (!fidp->ref && fidp->clunked) {
if (fidp->fid == pdu->s->root_fid) {
/*
* if the clunked fid is root fid ... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,160 | static void stat_to_qid(const struct stat *stbuf, V9fsQID *qidp)
{
size_t size;
memset(&qidp->path, 0, sizeof(qidp->path));
size = MIN(sizeof(stbuf->st_ino), sizeof(qidp->path));
memcpy(&qidp->path, &stbuf->st_ino, size);
qidp->version = stbuf->st_mtime ^ (stbuf->st_size << 8);
qidp->type = 0;
... | DoS | 0 | static void stat_to_qid(const struct stat *stbuf, V9fsQID *qidp)
{
size_t size;
memset(&qidp->path, 0, sizeof(qidp->path));
size = MIN(sizeof(stbuf->st_ino), sizeof(qidp->path));
memcpy(&qidp->path, &stbuf->st_ino, size);
qidp->version = stbuf->st_mtime ^ (stbuf->st_size << 8);
qidp->type = 0;
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,161 | static uint32_t stat_to_v9mode(const struct stat *stbuf)
{
uint32_t mode;
mode = stbuf->st_mode & 0777;
if (S_ISDIR(stbuf->st_mode)) {
mode |= P9_STAT_MODE_DIR;
}
if (S_ISLNK(stbuf->st_mode)) {
mode |= P9_STAT_MODE_SYMLINK;
}
if (S_ISSOCK(stbuf->st_mode)) {
mode |=... | DoS | 0 | static uint32_t stat_to_v9mode(const struct stat *stbuf)
{
uint32_t mode;
mode = stbuf->st_mode & 0777;
if (S_ISDIR(stbuf->st_mode)) {
mode |= P9_STAT_MODE_DIR;
}
if (S_ISLNK(stbuf->st_mode)) {
mode |= P9_STAT_MODE_SYMLINK;
}
if (S_ISSOCK(stbuf->st_mode)) {
mode |=... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,162 | static int coroutine_fn stat_to_v9stat(V9fsPDU *pdu, V9fsPath *path,
const char *basename,
const struct stat *stbuf,
V9fsStat *v9stat)
{
int err;
memset(v9stat, 0, sizeof(*v9stat));
stat_to... | DoS | 0 | static int coroutine_fn stat_to_v9stat(V9fsPDU *pdu, V9fsPath *path,
const char *basename,
const struct stat *stbuf,
V9fsStat *v9stat)
{
int err;
memset(v9stat, 0, sizeof(*v9stat));
stat_to... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,163 | static void stat_to_v9stat_dotl(V9fsState *s, const struct stat *stbuf,
V9fsStatDotl *v9lstat)
{
memset(v9lstat, 0, sizeof(*v9lstat));
v9lstat->st_mode = stbuf->st_mode;
v9lstat->st_nlink = stbuf->st_nlink;
v9lstat->st_uid = stbuf->st_uid;
v9lstat->st_gid = stbuf->st... | DoS | 0 | static void stat_to_v9stat_dotl(V9fsState *s, const struct stat *stbuf,
V9fsStatDotl *v9lstat)
{
memset(v9lstat, 0, sizeof(*v9lstat));
v9lstat->st_mode = stbuf->st_mode;
v9lstat->st_nlink = stbuf->st_nlink;
v9lstat->st_uid = stbuf->st_uid;
v9lstat->st_gid = stbuf->st... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,164 | static void coroutine_fn v9fs_attach(void *opaque)
{
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t fid, afid, n_uname;
V9fsString uname, aname;
V9fsFidState *fidp;
size_t offset = 7;
V9fsQID qid;
ssize_t err;
Error *local_err = NULL;
v9fs_string_init(&uname);
v9fs_st... | DoS | 0 | static void coroutine_fn v9fs_attach(void *opaque)
{
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t fid, afid, n_uname;
V9fsString uname, aname;
V9fsFidState *fidp;
size_t offset = 7;
V9fsQID qid;
ssize_t err;
Error *local_err = NULL;
v9fs_string_init(&uname);
v9fs_st... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,165 | static void coroutine_fn v9fs_clunk(void *opaque)
{
int err;
int32_t fid;
size_t offset = 7;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "d", &fid);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_clunk(pdu->tag, pdu->id... | DoS | 0 | static void coroutine_fn v9fs_clunk(void *opaque)
{
int err;
int32_t fid;
size_t offset = 7;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "d", &fid);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_clunk(pdu->tag, pdu->id... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,166 | static int coroutine_fn v9fs_complete_rename(V9fsPDU *pdu, V9fsFidState *fidp,
int32_t newdirfid,
V9fsString *name)
{
int err = 0;
V9fsPath new_path;
V9fsFidState *tfidp;
V9fsState *s = pdu->s;
V9fsFidState *di... | DoS | 0 | static int coroutine_fn v9fs_complete_rename(V9fsPDU *pdu, V9fsFidState *fidp,
int32_t newdirfid,
V9fsString *name)
{
int err = 0;
V9fsPath new_path;
V9fsFidState *tfidp;
V9fsState *s = pdu->s;
V9fsFidState *di... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,167 | static void coroutine_fn v9fs_create(void *opaque)
{
int32_t fid;
int err = 0;
size_t offset = 7;
V9fsFidState *fidp;
V9fsQID qid;
int32_t perm;
int8_t mode;
V9fsPath path;
struct stat stbuf;
V9fsString name;
V9fsString extension;
int iounit;
V9fsPDU *pdu = opaque;
... | DoS | 0 | static void coroutine_fn v9fs_create(void *opaque)
{
int32_t fid;
int err = 0;
size_t offset = 7;
V9fsFidState *fidp;
V9fsQID qid;
int32_t perm;
int8_t mode;
V9fsPath path;
struct stat stbuf;
V9fsString name;
V9fsString extension;
int iounit;
V9fsPDU *pdu = opaque;
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,168 | static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
V9fsFidState *fidp,
uint32_t max_count)
{
V9fsPath path;
V9fsStat v9stat;
int len, err = 0;
int32_t count = 0;
struct stat stbuf;
of... | DoS | 0 | static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
V9fsFidState *fidp,
uint32_t max_count)
{
V9fsPath path;
V9fsStat v9stat;
int len, err = 0;
int32_t count = 0;
struct stat stbuf;
of... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,169 | static int coroutine_fn v9fs_fix_fid_paths(V9fsPDU *pdu, V9fsPath *olddir,
V9fsString *old_name,
V9fsPath *newdir,
V9fsString *new_name)
{
V9fsFidState *tfidp;
V9fsPath oldpath, newpa... | DoS | 0 | static int coroutine_fn v9fs_fix_fid_paths(V9fsPDU *pdu, V9fsPath *olddir,
V9fsString *old_name,
V9fsPath *newdir,
V9fsString *new_name)
{
V9fsFidState *tfidp;
V9fsPath oldpath, newpa... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,170 | static void v9fs_fix_path(V9fsPath *dst, V9fsPath *src, int len)
{
V9fsPath str;
v9fs_path_init(&str);
v9fs_path_copy(&str, dst);
v9fs_path_sprintf(dst, "%s%s", src->data, str.data + len);
v9fs_path_free(&str);
}
| DoS | 0 | static void v9fs_fix_path(V9fsPath *dst, V9fsPath *src, int len)
{
V9fsPath str;
v9fs_path_init(&str);
v9fs_path_copy(&str, dst);
v9fs_path_sprintf(dst, "%s%s", src->data, str.data + len);
v9fs_path_free(&str);
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,171 | static void coroutine_fn v9fs_flush(void *opaque)
{
ssize_t err;
int16_t tag;
size_t offset = 7;
V9fsPDU *cancel_pdu = NULL;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "w", &tag);
if (err < 0) {
pdu_complete(pdu, err);
return;
}
... | DoS | 0 | static void coroutine_fn v9fs_flush(void *opaque)
{
ssize_t err;
int16_t tag;
size_t offset = 7;
V9fsPDU *cancel_pdu = NULL;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "w", &tag);
if (err < 0) {
pdu_complete(pdu, err);
return;
}
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,172 | static void coroutine_fn v9fs_getattr(void *opaque)
{
int32_t fid;
size_t offset = 7;
ssize_t retval = 0;
struct stat stbuf;
V9fsFidState *fidp;
uint64_t request_mask;
V9fsStatDotl v9stat_dotl;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
retval = pdu_unmarshal(pdu, offset, "dq... | DoS | 0 | static void coroutine_fn v9fs_getattr(void *opaque)
{
int32_t fid;
size_t offset = 7;
ssize_t retval = 0;
struct stat stbuf;
V9fsFidState *fidp;
uint64_t request_mask;
V9fsStatDotl v9stat_dotl;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
retval = pdu_unmarshal(pdu, offset, "dq... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,173 | static void v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu,
size_t skip, size_t size,
bool is_write)
{
QEMUIOVector elem;
struct iovec *iov;
unsigned int niov;
if (is_write) {
pdu->s->transport->init_out_iov_from_... | DoS | 0 | static void v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu,
size_t skip, size_t size,
bool is_write)
{
QEMUIOVector elem;
struct iovec *iov;
unsigned int niov;
if (is_write) {
pdu->s->transport->init_out_iov_from_... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,174 | static void coroutine_fn v9fs_lcreate(void *opaque)
{
int32_t dfid, flags, mode;
gid_t gid;
ssize_t err = 0;
ssize_t offset = 7;
V9fsString name;
V9fsFidState *fidp;
struct stat stbuf;
V9fsQID qid;
int32_t iounit;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu... | DoS | 0 | static void coroutine_fn v9fs_lcreate(void *opaque)
{
int32_t dfid, flags, mode;
gid_t gid;
ssize_t err = 0;
ssize_t offset = 7;
V9fsString name;
V9fsFidState *fidp;
struct stat stbuf;
V9fsQID qid;
int32_t iounit;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,175 | static void coroutine_fn v9fs_link(void *opaque)
{
V9fsPDU *pdu = opaque;
int32_t dfid, oldfid;
V9fsFidState *dfidp, *oldfidp;
V9fsString name;
size_t offset = 7;
int err = 0;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name);
if (err < 0) {
... | DoS | 0 | static void coroutine_fn v9fs_link(void *opaque)
{
V9fsPDU *pdu = opaque;
int32_t dfid, oldfid;
V9fsFidState *dfidp, *oldfidp;
V9fsString name;
size_t offset = 7;
int err = 0;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name);
if (err < 0) {
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,176 | static int coroutine_fn v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath *path)
{
int err;
V9fsState *s = pdu->s;
V9fsFidState *fidp, head_fid;
head_fid.next = s->fid_list;
for (fidp = s->fid_list; fidp; fidp = fidp->next) {
if (fidp->path.size != path->size) {
continue;
... | DoS | 0 | static int coroutine_fn v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath *path)
{
int err;
V9fsState *s = pdu->s;
V9fsFidState *fidp, head_fid;
head_fid.next = s->fid_list;
for (fidp = s->fid_list; fidp; fidp = fidp->next) {
if (fidp->path.size != path->size) {
continue;
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,177 | int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath,
const char *name, V9fsPath *path)
{
int err;
err = s->ops->name_to_path(&s->ctx, dirpath, name, path);
if (err < 0) {
err = -errno;
}
return err;
}
| DoS | 0 | int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath,
const char *name, V9fsPath *path)
{
int err;
err = s->ops->name_to_path(&s->ctx, dirpath, name, path);
if (err < 0) {
err = -errno;
}
return err;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,178 | static void coroutine_fn v9fs_open(void *opaque)
{
int flags;
int32_t fid;
int32_t mode;
V9fsQID qid;
int iounit = 0;
ssize_t err = 0;
size_t offset = 7;
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
if (s->proto_version == V9FS_PRO... | DoS | 0 | static void coroutine_fn v9fs_open(void *opaque)
{
int flags;
int32_t fid;
int32_t mode;
V9fsQID qid;
int iounit = 0;
ssize_t err = 0;
size_t offset = 7;
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
if (s->proto_version == V9FS_PRO... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,179 | void v9fs_path_copy(V9fsPath *dst, const V9fsPath *src)
{
v9fs_path_free(dst);
dst->size = src->size;
dst->data = g_memdup(src->data, src->size);
}
| DoS | 0 | void v9fs_path_copy(V9fsPath *dst, const V9fsPath *src)
{
v9fs_path_free(dst);
dst->size = src->size;
dst->data = g_memdup(src->data, src->size);
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,180 | void v9fs_path_free(V9fsPath *path)
{
g_free(path->data);
path->data = NULL;
path->size = 0;
}
| DoS | 0 | void v9fs_path_free(V9fsPath *path)
{
g_free(path->data);
path->data = NULL;
path->size = 0;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,181 | void v9fs_path_init(V9fsPath *path)
{
path->data = NULL;
path->size = 0;
}
| DoS | 0 | void v9fs_path_init(V9fsPath *path)
{
path->data = NULL;
path->size = 0;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,182 | static int v9fs_path_is_ancestor(V9fsPath *s1, V9fsPath *s2)
{
if (!strncmp(s1->data, s2->data, s1->size - 1)) {
if (s2->data[s1->size - 1] == '\0' || s2->data[s1->size - 1] == '/') {
return 1;
}
}
return 0;
}
| DoS | 0 | static int v9fs_path_is_ancestor(V9fsPath *s1, V9fsPath *s2)
{
if (!strncmp(s1->data, s2->data, s1->size - 1)) {
if (s2->data[s1->size - 1] == '\0' || s2->data[s1->size - 1] == '/') {
return 1;
}
}
return 0;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,183 | v9fs_path_sprintf(V9fsPath *path, const char *fmt, ...)
{
va_list ap;
v9fs_path_free(path);
va_start(ap, fmt);
/* Bump the size for including terminating NULL */
path->size = g_vasprintf(&path->data, fmt, ap) + 1;
va_end(ap);
}
| DoS | 0 | v9fs_path_sprintf(V9fsPath *path, const char *fmt, ...)
{
va_list ap;
v9fs_path_free(path);
va_start(ap, fmt);
/* Bump the size for including terminating NULL */
path->size = g_vasprintf(&path->data, fmt, ap) + 1;
va_end(ap);
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,184 | static void coroutine_fn v9fs_read(void *opaque)
{
int32_t fid;
uint64_t off;
ssize_t err = 0;
int32_t count = 0;
size_t offset = 7;
uint32_t max_count;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &max_cou... | DoS | 0 | static void coroutine_fn v9fs_read(void *opaque)
{
int32_t fid;
uint64_t off;
ssize_t err = 0;
int32_t count = 0;
size_t offset = 7;
uint32_t max_count;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &max_cou... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,185 | static void coroutine_fn v9fs_readdir(void *opaque)
{
int32_t fid;
V9fsFidState *fidp;
ssize_t retval = 0;
size_t offset = 7;
uint64_t initial_offset;
int32_t count;
uint32_t max_count;
V9fsPDU *pdu = opaque;
retval = pdu_unmarshal(pdu, offset, "dqd", &fid,
... | DoS | 0 | static void coroutine_fn v9fs_readdir(void *opaque)
{
int32_t fid;
V9fsFidState *fidp;
ssize_t retval = 0;
size_t offset = 7;
uint64_t initial_offset;
int32_t count;
uint32_t max_count;
V9fsPDU *pdu = opaque;
retval = pdu_unmarshal(pdu, offset, "dqd", &fid,
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,186 | static size_t v9fs_readdir_data_size(V9fsString *name)
{
/*
* Size of each dirent on the wire: size of qid (13) + size of offset (8)
* size of type (1) + size of name.size (2) + strlen(name.data)
*/
return 24 + v9fs_string_size(name);
}
| DoS | 0 | static size_t v9fs_readdir_data_size(V9fsString *name)
{
/*
* Size of each dirent on the wire: size of qid (13) + size of offset (8)
* size of type (1) + size of name.size (2) + strlen(name.data)
*/
return 24 + v9fs_string_size(name);
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,187 | void coroutine_fn v9fs_reclaim_fd(V9fsPDU *pdu)
{
int reclaim_count = 0;
V9fsState *s = pdu->s;
V9fsFidState *f, *reclaim_list = NULL;
for (f = s->fid_list; f; f = f->next) {
/*
* Unlink fids cannot be reclaimed. Check
* for them and skip them. Also skip fids
* curren... | DoS | 0 | void coroutine_fn v9fs_reclaim_fd(V9fsPDU *pdu)
{
int reclaim_count = 0;
V9fsState *s = pdu->s;
V9fsFidState *f, *reclaim_list = NULL;
for (f = s->fid_list; f; f = f->next) {
/*
* Unlink fids cannot be reclaimed. Check
* for them and skip them. Also skip fids
* curren... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,188 | static void coroutine_fn v9fs_renameat(void *opaque)
{
ssize_t err = 0;
size_t offset = 7;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t olddirfid, newdirfid;
V9fsString old_name, new_name;
v9fs_string_init(&old_name);
v9fs_string_init(&new_name);
err = pdu_unmarshal(pdu, of... | DoS | 0 | static void coroutine_fn v9fs_renameat(void *opaque)
{
ssize_t err = 0;
size_t offset = 7;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
int32_t olddirfid, newdirfid;
V9fsString old_name, new_name;
v9fs_string_init(&old_name);
v9fs_string_init(&new_name);
err = pdu_unmarshal(pdu, of... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,189 | static int coroutine_fn v9fs_reopen_fid(V9fsPDU *pdu, V9fsFidState *f)
{
int err = 1;
if (f->fid_type == P9_FID_FILE) {
if (f->fs.fd == -1) {
do {
err = v9fs_co_open(pdu, f, f->open_flags);
} while (err == -EINTR && !pdu->cancelled);
}
} else if (f->fi... | DoS | 0 | static int coroutine_fn v9fs_reopen_fid(V9fsPDU *pdu, V9fsFidState *f)
{
int err = 1;
if (f->fid_type == P9_FID_FILE) {
if (f->fs.fd == -1) {
do {
err = v9fs_co_open(pdu, f, f->open_flags);
} while (err == -EINTR && !pdu->cancelled);
}
} else if (f->fi... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,190 | static void coroutine_fn v9fs_stat(void *opaque)
{
int32_t fid;
V9fsStat v9stat;
ssize_t err = 0;
size_t offset = 7;
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
char *basename;
err = pdu_unmarshal(pdu, offset, "d", &fid);
if (err < 0) {
goto out_nofid;
... | DoS | 0 | static void coroutine_fn v9fs_stat(void *opaque)
{
int32_t fid;
V9fsStat v9stat;
ssize_t err = 0;
size_t offset = 7;
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
char *basename;
err = pdu_unmarshal(pdu, offset, "d", &fid);
if (err < 0) {
goto out_nofid;
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,191 | static void v9fs_stat_free(V9fsStat *stat)
{
v9fs_string_free(&stat->name);
v9fs_string_free(&stat->uid);
v9fs_string_free(&stat->gid);
v9fs_string_free(&stat->muid);
v9fs_string_free(&stat->extension);
}
| DoS | 0 | static void v9fs_stat_free(V9fsStat *stat)
{
v9fs_string_free(&stat->name);
v9fs_string_free(&stat->uid);
v9fs_string_free(&stat->gid);
v9fs_string_free(&stat->muid);
v9fs_string_free(&stat->extension);
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,192 | static size_t v9fs_string_size(V9fsString *str)
{
return str->size;
}
| DoS | 0 | static size_t v9fs_string_size(V9fsString *str)
{
return str->size;
}
| @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,193 | static void coroutine_fn v9fs_symlink(void *opaque)
{
V9fsPDU *pdu = opaque;
V9fsString name;
V9fsString symname;
V9fsFidState *dfidp;
V9fsQID qid;
struct stat stbuf;
int32_t dfid;
int err = 0;
gid_t gid;
size_t offset = 7;
v9fs_string_init(&name);
v9fs_string_init(&symn... | DoS | 0 | static void coroutine_fn v9fs_symlink(void *opaque)
{
V9fsPDU *pdu = opaque;
V9fsString name;
V9fsString symname;
V9fsFidState *dfidp;
V9fsQID qid;
struct stat stbuf;
int32_t dfid;
int err = 0;
gid_t gid;
size_t offset = 7;
v9fs_string_init(&name);
v9fs_string_init(&symn... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,194 | static void coroutine_fn v9fs_unlinkat(void *opaque)
{
int err = 0;
V9fsString name;
int32_t dfid, flags, rflags = 0;
size_t offset = 7;
V9fsPath path;
V9fsFidState *dfidp;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsd", &dfid, &name, &flags);... | DoS | 0 | static void coroutine_fn v9fs_unlinkat(void *opaque)
{
int err = 0;
V9fsString name;
int32_t dfid, flags, rflags = 0;
size_t offset = 7;
V9fsPath path;
V9fsFidState *dfidp;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsd", &dfid, &name, &flags);... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,195 | static int v9fs_walk_marshal(V9fsPDU *pdu, uint16_t nwnames, V9fsQID *qids)
{
int i;
ssize_t err;
size_t offset = 7;
err = pdu_marshal(pdu, offset, "w", nwnames);
if (err < 0) {
return err;
}
offset += err;
for (i = 0; i < nwnames; i++) {
err = pdu_marshal(pdu, offset, "... | DoS | 0 | static int v9fs_walk_marshal(V9fsPDU *pdu, uint16_t nwnames, V9fsQID *qids)
{
int i;
ssize_t err;
size_t offset = 7;
err = pdu_marshal(pdu, offset, "w", nwnames);
if (err < 0) {
return err;
}
offset += err;
for (i = 0; i < nwnames; i++) {
err = pdu_marshal(pdu, offset, "... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,196 | static void coroutine_fn v9fs_write(void *opaque)
{
ssize_t err;
int32_t fid;
uint64_t off;
uint32_t count;
int32_t len = 0;
int32_t total = 0;
size_t offset = 7;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
QEMUIOVector qiov_full;
QEMUIOVector qiov;
... | DoS | 0 | static void coroutine_fn v9fs_write(void *opaque)
{
ssize_t err;
int32_t fid;
uint64_t off;
uint32_t count;
int32_t len = 0;
int32_t total = 0;
size_t offset = 7;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
QEMUIOVector qiov_full;
QEMUIOVector qiov;
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,197 | static int v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
uint64_t off, uint32_t max_count)
{
ssize_t err;
size_t offset = 7;
uint64_t read_count;
QEMUIOVector qiov_full;
if (fidp->fs.xattr.len < off) {
read_count = 0;
} else {
read_co... | DoS | 0 | static int v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
uint64_t off, uint32_t max_count)
{
ssize_t err;
size_t offset = 7;
uint64_t read_count;
QEMUIOVector qiov_full;
if (fidp->fs.xattr.len < off) {
read_count = 0;
} else {
read_co... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,198 | static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension)
{
mode_t ret;
ret = mode & 0777;
if (mode & P9_STAT_MODE_DIR) {
ret |= S_IFDIR;
}
if (mode & P9_STAT_MODE_SYMLINK) {
ret |= S_IFLNK;
}
if (mode & P9_STAT_MODE_SOCKET) {
ret |= S_IFSOCK;
}
if ... | DoS | 0 | static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension)
{
mode_t ret;
ret = mode & 0777;
if (mode & P9_STAT_MODE_DIR) {
ret |= S_IFDIR;
}
if (mode & P9_STAT_MODE_SYMLINK) {
ret |= S_IFLNK;
}
if (mode & P9_STAT_MODE_SOCKET) {
ret |= S_IFSOCK;
}
if ... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
1,199 | static void coroutine_fn virtfs_reset(V9fsPDU *pdu)
{
V9fsState *s = pdu->s;
V9fsFidState *fidp;
/* Free all fids */
while (s->fid_list) {
/* Get fid */
fidp = s->fid_list;
fidp->ref++;
/* Clunk fid */
s->fid_list = fidp->next;
fidp->clunked = 1;
... | DoS | 0 | static void coroutine_fn virtfs_reset(V9fsPDU *pdu)
{
V9fsState *s = pdu->s;
V9fsFidState *fidp;
/* Free all fids */
while (s->fid_list) {
/* Get fid */
fidp = s->fid_list;
fidp->ref++;
/* Clunk fid */
s->fid_list = fidp->next;
fidp->clunked = 1;
... | @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque)
struct stat stbuf;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
+ V9fsState *s = pdu->s;
v9fs_stat_init(&v9stat);
err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat);
@@ -2920,7 +2921,9 @@ static void corouti... | CWE-362 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.