func
stringlengths 0
484k
| target
int64 0
1
| cwe
listlengths 0
4
| project
stringclasses 799
values | commit_id
stringlengths 40
40
| hash
float64 1,215,700,430,453,689,100,000,000B
340,281,914,521,452,260,000,000,000,000B
| size
int64 1
24k
| message
stringlengths 0
13.3k
|
---|---|---|---|---|---|---|---|
static u32 ccp_gen_jobid(struct ccp_device *ccp)
{
return atomic_inc_return(&ccp->current_id) & CCP_JOBID_MASK;
}
| 0 |
[
"CWE-400",
"CWE-401"
] |
linux
|
128c66429247add5128c03dc1e144ca56f05a4e2
| 85,565,787,184,727,070,000,000,000,000,000,000,000 | 4 |
crypto: ccp - Release all allocated memory if sha type is invalid
Release all allocated memory if sha type is invalid:
In ccp_run_sha_cmd, if the type of sha is invalid, the allocated
hmac_buf should be released.
v2: fix the goto.
Signed-off-by: Navid Emamdoost <[email protected]>
Acked-by: Gary R Hook <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
|
MagickExport MagickBooleanType DrawGradientImage(Image *image,
const DrawInfo *draw_info)
{
CacheView
*image_view;
const GradientInfo
*gradient;
const SegmentInfo
*gradient_vector;
double
length;
ExceptionInfo
*exception;
MagickBooleanType
status;
MagickPixelPacket
zero;
PointInfo
point;
RectangleInfo
bounding_box;
ssize_t
y;
/*
Draw linear or radial gradient on image.
*/
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(draw_info != (const DrawInfo *) NULL);
gradient=(&draw_info->gradient);
gradient_vector=(&gradient->gradient_vector);
point.x=gradient_vector->x2-gradient_vector->x1;
point.y=gradient_vector->y2-gradient_vector->y1;
length=sqrt(point.x*point.x+point.y*point.y);
bounding_box=gradient->bounding_box;
status=MagickTrue;
exception=(&image->exception);
GetMagickPixelPacket(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(status) \
magick_number_threads(image,image,bounding_box.height-bounding_box.y,1)
#endif
for (y=bounding_box.y; y < (ssize_t) bounding_box.height; y++)
{
double
alpha,
offset;
MagickPixelPacket
composite,
pixel;
IndexPacket
*magick_restrict indexes;
ssize_t
i,
x;
PixelPacket
*magick_restrict q;
ssize_t
j;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
pixel=zero;
composite=zero;
offset=GetStopColorOffset(gradient,0,y);
if (gradient->type != RadialGradient)
offset*=PerceptibleReciprocal(length);
for (x=bounding_box.x; x < (ssize_t) bounding_box.width; x++)
{
SetMagickPixelPacket(image,q,indexes+x,&pixel);
switch (gradient->spread)
{
case UndefinedSpread:
case PadSpread:
{
if ((x != CastDoubleToLong(ceil(gradient_vector->x1-0.5))) ||
(y != CastDoubleToLong(ceil(gradient_vector->y1-0.5))))
{
offset=GetStopColorOffset(gradient,x,y);
if (gradient->type != RadialGradient)
offset*=PerceptibleReciprocal(length);
}
for (i=0; i < (ssize_t) gradient->number_stops; i++)
if (offset < gradient->stops[i].offset)
break;
if ((offset < 0.0) || (i == 0))
composite=gradient->stops[0].color;
else
if ((offset > 1.0) || (i == (ssize_t) gradient->number_stops))
composite=gradient->stops[gradient->number_stops-1].color;
else
{
j=i;
i--;
alpha=(offset-gradient->stops[i].offset)/
(gradient->stops[j].offset-gradient->stops[i].offset);
MagickPixelCompositeBlend(&gradient->stops[i].color,1.0-alpha,
&gradient->stops[j].color,alpha,&composite);
}
break;
}
case ReflectSpread:
{
if ((x != CastDoubleToLong(ceil(gradient_vector->x1-0.5))) ||
(y != CastDoubleToLong(ceil(gradient_vector->y1-0.5))))
{
offset=GetStopColorOffset(gradient,x,y);
if (gradient->type != RadialGradient)
offset*=PerceptibleReciprocal(length);
}
if (offset < 0.0)
offset=(-offset);
if ((ssize_t) fmod(offset,2.0) == 0)
offset=fmod(offset,1.0);
else
offset=1.0-fmod(offset,1.0);
for (i=0; i < (ssize_t) gradient->number_stops; i++)
if (offset < gradient->stops[i].offset)
break;
if (i == 0)
composite=gradient->stops[0].color;
else
if (i == (ssize_t) gradient->number_stops)
composite=gradient->stops[gradient->number_stops-1].color;
else
{
j=i;
i--;
alpha=(offset-gradient->stops[i].offset)/
(gradient->stops[j].offset-gradient->stops[i].offset);
MagickPixelCompositeBlend(&gradient->stops[i].color,1.0-alpha,
&gradient->stops[j].color,alpha,&composite);
}
break;
}
case RepeatSpread:
{
double
repeat;
MagickBooleanType
antialias;
antialias=MagickFalse;
repeat=0.0;
if ((x != CastDoubleToLong(ceil(gradient_vector->x1-0.5))) ||
(y != CastDoubleToLong(ceil(gradient_vector->y1-0.5))))
{
offset=GetStopColorOffset(gradient,x,y);
if (gradient->type == LinearGradient)
{
repeat=fmod(offset,length);
if (repeat < 0.0)
repeat=length-fmod(-repeat,length);
else
repeat=fmod(offset,length);
antialias=(repeat < length) && ((repeat+1.0) > length) ?
MagickTrue : MagickFalse;
offset=PerceptibleReciprocal(length)*repeat;
}
else
{
repeat=fmod(offset,(double) gradient->radius);
if (repeat < 0.0)
repeat=gradient->radius-fmod(-repeat,
(double) gradient->radius);
else
repeat=fmod(offset,(double) gradient->radius);
antialias=repeat+1.0 > gradient->radius ? MagickTrue :
MagickFalse;
offset=repeat/gradient->radius;
}
}
for (i=0; i < (ssize_t) gradient->number_stops; i++)
if (offset < gradient->stops[i].offset)
break;
if (i == 0)
composite=gradient->stops[0].color;
else
if (i == (ssize_t) gradient->number_stops)
composite=gradient->stops[gradient->number_stops-1].color;
else
{
j=i;
i--;
alpha=(offset-gradient->stops[i].offset)/
(gradient->stops[j].offset-gradient->stops[i].offset);
if (antialias != MagickFalse)
{
if (gradient->type == LinearGradient)
alpha=length-repeat;
else
alpha=gradient->radius-repeat;
i=0;
j=(ssize_t) gradient->number_stops-1L;
}
MagickPixelCompositeBlend(&gradient->stops[i].color,1.0-alpha,
&gradient->stops[j].color,alpha,&composite);
}
break;
}
}
MagickPixelCompositeOver(&composite,composite.opacity,&pixel,
pixel.opacity,&pixel);
SetPixelPacket(image,&pixel,q,indexes+x);
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
image_view=DestroyCacheView(image_view);
return(status);
}
| 1 |
[] |
ImageMagick6
|
4b5e026c704d777efe9c2ead5dd68ca4fe3b2aa1
| 66,456,930,049,184,230,000,000,000,000,000,000,000 | 238 |
https://github.com/ImageMagick/ImageMagick/issues/3338
|
int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
int purpose, int trust)
{
int idx;
/* If purpose not set use default */
if (!purpose) purpose = def_purpose;
/* If we have a purpose then check it is valid */
if (purpose)
{
X509_PURPOSE *ptmp;
idx = X509_PURPOSE_get_by_id(purpose);
if (idx == -1)
{
X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
X509_R_UNKNOWN_PURPOSE_ID);
return 0;
}
ptmp = X509_PURPOSE_get0(idx);
if (ptmp->trust == X509_TRUST_DEFAULT)
{
idx = X509_PURPOSE_get_by_id(def_purpose);
if (idx == -1)
{
X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
X509_R_UNKNOWN_PURPOSE_ID);
return 0;
}
ptmp = X509_PURPOSE_get0(idx);
}
/* If trust not set then get from purpose default */
if (!trust) trust = ptmp->trust;
}
if (trust)
{
idx = X509_TRUST_get_by_id(trust);
if (idx == -1)
{
X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
X509_R_UNKNOWN_TRUST_ID);
return 0;
}
}
if (purpose && !ctx->param->purpose) ctx->param->purpose = purpose;
if (trust && !ctx->param->trust) ctx->param->trust = trust;
return 1;
}
| 0 |
[] |
openssl
|
d65b8b2162f33ac0d53dace588a0847ed827626c
| 148,420,811,155,427,000,000,000,000,000,000,000,000 | 47 |
Backport OCSP fixes.
|
uint64_t cli_bytecode_context_getresult_int(struct cli_bc_ctx *ctx)
{
return *(uint32_t*)ctx->values;/*XXX*/
}
| 0 |
[
"CWE-189"
] |
clamav-devel
|
3d664817f6ef833a17414a4ecea42004c35cc42f
| 247,538,723,460,871,500,000,000,000,000,000,000,000 | 4 |
fix recursion level crash (bb #3706).
Thanks to Stephane Chazelas for the analysis.
|
style_value_data_new (const gchar *value, gboolean important)
{
StyleValueData *ret;
ret = g_new (StyleValueData, 1);
ret->value = g_strdup (value);
ret->important = important;
return ret;
}
| 0 |
[
"CWE-20"
] |
librsvg
|
d1c9191949747f6dcfd207831d15dd4ba00e31f2
| 90,410,985,008,476,500,000,000,000,000,000,000,000 | 10 |
state: Store mask as reference
Instead of immediately looking up the mask, store the reference and look
it up on use.
|
ambsdtar_estimate(
application_argument_t *argument)
{
char *incrname = NULL;
GPtrArray *argv_ptr;
char *cmd = NULL;
int nullfd = -1;
int pipefd = -1;
FILE *dumpout = NULL;
off_t size = -1;
char line[32768];
char *errmsg = NULL;
char *qerrmsg = NULL;
char *qdisk = NULL;
amwait_t wait_status;
int tarpid;
amregex_t *rp;
times_t start_time;
int level;
GSList *levels;
char *file_exclude = NULL;
char *file_include = NULL;
GString *strbuf;
char *option;
if (!argument->level) {
fprintf(stderr, "ERROR No level argument\n");
error(_("No level argument"));
}
if (!argument->dle.disk) {
fprintf(stderr, "ERROR No disk argument\n");
error(_("No disk argument"));
}
if (!argument->dle.device) {
fprintf(stderr, "ERROR No device argument\n");
error(_("No device argument"));
}
if ((option = validate_command_options(argument))) {
fprintf(stdout, "ERROR Invalid '%s' COMMAND-OPTIONS\n", option);
error("Invalid '%s' COMMAND-OPTIONS", option);
}
if (argument->calcsize) {
char *dirname;
int nb_exclude;
int nb_include;
char *calcsize = g_strjoin(NULL, amlibexecdir, "/", "calcsize", NULL);
if (!check_exec_for_suid(calcsize, FALSE)) {
errmsg = g_strdup_printf("'%s' binary is not secure", calcsize);
goto common_error;
return;
}
if (bsdtar_directory) {
dirname = bsdtar_directory;
} else {
dirname = argument->dle.device;
}
ambsdtar_build_exinclude(&argument->dle, 1,
&nb_exclude, &file_exclude,
&nb_include, &file_include);
run_calcsize(argument->config, "BSDTAR", argument->dle.disk, dirname,
argument->level, file_exclude, file_include);
if (argument->verbose == 0) {
if (file_exclude)
unlink(file_exclude);
if (file_include)
unlink(file_include);
}
amfree(file_exclude);
amfree(file_include);
amfree(qdisk);
return;
}
if (!bsdtar_path) {
errmsg = g_strdup(_("BSDTAR-PATH not defined"));
goto common_error;
}
if (!check_exec_for_suid(bsdtar_path, FALSE)) {
errmsg = g_strdup_printf("'%s' binary is not secure", bsdtar_path);
goto common_error;
}
if (!state_dir) {
errmsg = g_strdup(_("STATE-DIR not defined"));
goto common_error;
}
qdisk = quote_string(argument->dle.disk);
for (levels = argument->level; levels != NULL; levels = levels->next) {
char *timestamps;
level = GPOINTER_TO_INT(levels->data);
timestamps = ambsdtar_get_timestamps(argument, level, stdout, CMD_ESTIMATE);
cmd = g_strdup(bsdtar_path);
argv_ptr = ambsdtar_build_argv(argument, timestamps, &file_exclude,
&file_include, CMD_ESTIMATE);
amfree(timestamps);
start_time = curclock();
if ((nullfd = open("/dev/null", O_RDWR)) == -1) {
errmsg = g_strdup_printf(_("Cannot access /dev/null : %s"),
strerror(errno));
goto common_exit;
}
tarpid = pipespawnv(cmd, STDERR_PIPE, 1,
&nullfd, &nullfd, &pipefd,
(char **)argv_ptr->pdata);
dumpout = fdopen(pipefd,"r");
if (!dumpout) {
error(_("Can't fdopen: %s"), strerror(errno));
/*NOTREACHED*/
}
size = (off_t)-1;
while (size < 0 && (fgets(line, sizeof(line), dumpout) != NULL)) {
if (strlen(line) > 0 && line[strlen(line)-1] == '\n') {
/* remove trailling \n */
line[strlen(line)-1] = '\0';
}
if (line[0] == '\0')
continue;
g_debug("%s", line);
/* check for size match */
/*@ignore@*/
for(rp = re_table; rp->regex != NULL; rp++) {
if(match(rp->regex, line)) {
if (rp->typ == DMP_SIZE) {
off_t blocksize = gblocksize;
size = ((the_num(line, rp->field)*rp->scale+1023.0)/1024.0);
if(size < 0.0)
size = 1.0; /* found on NeXT -- sigh */
if (!blocksize) {
blocksize = 20;
}
blocksize /= 2;
size = (size+blocksize-1) / blocksize;
size *= blocksize;
}
break;
}
}
/*@end@*/
}
while (fgets(line, sizeof(line), dumpout) != NULL) {
g_debug("%s", line);
}
g_debug(".....");
g_debug(_("estimate time for %s level %d: %s"),
qdisk,
level,
walltime_str(timessub(curclock(), start_time)));
if(size == (off_t)-1) {
errmsg = g_strdup_printf(_("no size line match in %s output"), cmd);
g_debug(_("%s for %s"), errmsg, qdisk);
g_debug(".....");
} else if(size == (off_t)0 && argument->level == 0) {
g_debug(_("possible %s problem -- is \"%s\" really empty?"),
cmd, argument->dle.disk);
g_debug(".....");
}
g_debug(_("estimate size for %s level %d: %lld KB"),
qdisk,
level,
(long long)size);
(void)kill(-tarpid, SIGTERM);
g_debug(_("waiting for %s \"%s\" child"), cmd, qdisk);
waitpid(tarpid, &wait_status, 0);
if (WIFSIGNALED(wait_status)) {
strbuf = g_string_new(errmsg);
g_string_append_printf(strbuf, "%s terminated with signal %d: see %s",
cmd, WTERMSIG(wait_status), dbfn());
g_free(errmsg);
errmsg = g_string_free(strbuf, FALSE);
exit_status = 1;
} else if (WIFEXITED(wait_status)) {
if (exit_value[WEXITSTATUS(wait_status)] == 1) {
strbuf = g_string_new(errmsg);
g_string_append_printf(strbuf, "%s exited with status %d: see %s",
cmd, WEXITSTATUS(wait_status), dbfn());
g_free(errmsg);
errmsg = g_string_free(strbuf, FALSE);
exit_status = 1;
} else {
/* Normal exit */
}
} else {
errmsg = g_strdup_printf(_("%s got bad exit: see %s"),
cmd, dbfn());
exit_status = 1;
}
g_debug(_("after %s %s wait"), cmd, qdisk);
common_exit:
if (errmsg) {
g_debug("%s", errmsg);
fprintf(stdout, "ERROR %s\n", errmsg);
amfree(errmsg);
}
if (argument->verbose == 0) {
if (file_exclude)
unlink(file_exclude);
if (file_include)
unlink(file_include);
}
g_ptr_array_free_full(argv_ptr);
amfree(cmd);
amfree(incrname);
aclose(nullfd);
afclose(dumpout);
fprintf(stdout, "%d %lld 1\n", level, (long long)size);
}
amfree(qdisk);
amfree(file_exclude);
amfree(file_include);
amfree(errmsg);
amfree(qerrmsg);
amfree(incrname);
return;
common_error:
qerrmsg = quote_string(errmsg);
amfree(qdisk);
g_debug("%s", errmsg);
fprintf(stdout, "ERROR %s\n", qerrmsg);
exit_status = 1;
amfree(file_exclude);
amfree(file_include);
amfree(errmsg);
amfree(qerrmsg);
amfree(incrname);
return;
}
| 0 |
[
"CWE-77"
] |
amanda
|
29bae2e271093cd8d06ea98f73a474c685c5a314
| 177,102,323,948,363,300,000,000,000,000,000,000,000 | 249 |
* application-src/ambsdtar.c, application-src/amgtar.c,
application-src/amstar.c: Filter option from COMMAND-OPTIONS
* common-src/ammessage.c: Add message.
git-svn-id: https://svn.code.sf.net/p/amanda/code/amanda/trunk@6483 a8d146d6-cc15-0410-8900-af154a0219e0
|
const std::string& QueryParams::param(const std::string& name, size_type n) const
{
for (size_type nn = 0; nn < _values.size(); ++nn)
{
if (_values[nn].name == name)
{
if (n == 0)
return _values[nn].value;
--n;
}
}
static std::string emptyValue;
return emptyValue;
}
| 0 |
[
"CWE-399"
] |
cxxtools
|
142bb2589dc184709857c08c1e10570947c444e3
| 69,895,671,019,783,310,000,000,000,000,000,000,000 | 15 |
fix parsing double % in query parameters
|
static int fastrpc_mmap(struct dma_buf *dmabuf,
struct vm_area_struct *vma)
{
struct fastrpc_buf *buf = dmabuf->priv;
size_t size = vma->vm_end - vma->vm_start;
return dma_mmap_coherent(buf->dev, vma, buf->virt,
FASTRPC_PHYS(buf->phys), size);
}
| 0 |
[
"CWE-400",
"CWE-401"
] |
linux
|
fc739a058d99c9297ef6bfd923b809d85855b9a9
| 125,270,870,200,086,130,000,000,000,000,000,000,000 | 9 |
misc: fastrpc: prevent memory leak in fastrpc_dma_buf_attach
In fastrpc_dma_buf_attach if dma_get_sgtable fails the allocated memory
for a should be released.
Signed-off-by: Navid Emamdoost <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
QPDF::pipeForeignStreamData(
PointerHolder<ForeignStreamData> foreign,
Pipeline* pipeline,
unsigned long encode_flags,
qpdf_stream_decode_level_e decode_level)
{
if (foreign->encp->encrypted)
{
QTC::TC("qpdf", "QPDF pipe foreign encrypted stream");
}
return pipeStreamData(
foreign->encp, foreign->file, *this,
foreign->foreign_objid, foreign->foreign_generation,
foreign->offset, foreign->length,
foreign->local_dict, foreign->is_attachment_stream,
pipeline, false, false);
}
| 1 |
[
"CWE-787"
] |
qpdf
|
d71f05ca07eb5c7cfa4d6d23e5c1f2a800f52e8e
| 77,543,988,018,663,960,000,000,000,000,000,000,000 | 17 |
Fix sign and conversion warnings (major)
This makes all integer type conversions that have potential data loss
explicit with calls that do range checks and raise an exception. After
this commit, qpdf builds with no warnings when -Wsign-conversion
-Wconversion is used with gcc or clang or when -W3 -Wd4800 is used
with MSVC. This significantly reduces the likelihood of potential
crashes from bogus integer values.
There are some parts of the code that take int when they should take
size_t or an offset. Such places would make qpdf not support files
with more than 2^31 of something that usually wouldn't be so large. In
the event that such a file shows up and is valid, at least qpdf would
raise an error in the right spot so the issue could be legitimately
addressed rather than failing in some weird way because of a silent
overflow condition.
|
oauth2_jwt_header_process(struct json_tree *tree, const char **alg_r,
const char **kid_r, const char **error_r)
{
const char *typ = get_field(tree, "typ");
const char *alg = get_field(tree, "alg");
const char *kid = get_field(tree, "kid");
if (null_strcmp(typ, "JWT") != 0) {
*error_r = "Cannot find 'typ' field";
return -1;
}
if (alg == NULL) {
*error_r = "Cannot find 'alg' field";
return -1;
}
/* These are lost when tree is deinitialized.
Make sure algorithm is uppercased. */
*alg_r = t_str_ucase(alg);
*kid_r = t_strdup(kid);
return 0;
}
| 0 |
[
"CWE-22"
] |
core
|
15682a20d5589ebf5496b31c55ecf9238ff2457b
| 186,946,200,502,450,980,000,000,000,000,000,000,000 | 23 |
lib-oauth2: Do not escape '.'
This is not really needed and just makes things difficult.
|
njs_decode_base64_core(njs_str_t *dst, const njs_str_t *src,
const u_char *basis)
{
size_t len;
u_char *d, *s;
s = src->start;
d = dst->start;
len = dst->length;
while (len >= 3) {
*d++ = (u_char) (basis[s[0]] << 2 | basis[s[1]] >> 4);
*d++ = (u_char) (basis[s[1]] << 4 | basis[s[2]] >> 2);
*d++ = (u_char) (basis[s[2]] << 6 | basis[s[3]]);
s += 4;
len -= 3;
}
if (len >= 1) {
*d++ = (u_char) (basis[s[0]] << 2 | basis[s[1]] >> 4);
}
if (len >= 2) {
*d++ = (u_char) (basis[s[1]] << 4 | basis[s[2]] >> 2);
}
}
| 0 |
[] |
njs
|
36f04a3178fcb6da8513cc3dbf35215c2a581b3f
| 159,807,621,032,978,000,000,000,000,000,000,000,000 | 28 |
Fixed String.prototype.replace() with byte strings.
This closes #522 issue on Github.
|
template<typename t>
CImgList<t>& move_to(CImgList<t>& list, const unsigned int pos=~0U) {
const unsigned int npos = pos>list._width?list._width:pos;
move_to(list.insert(1,npos)[npos]);
return list;
| 0 |
[
"CWE-125"
] |
CImg
|
10af1e8c1ad2a58a0a3342a856bae63e8f257abb
| 294,038,221,478,336,550,000,000,000,000,000,000,000 | 5 |
Fix other issues in 'CImg<T>::load_bmp()'.
|
static bool HHVM_FUNCTION(zip_entry_close, const Resource& zip_entry) {
auto zipEntry = cast<ZipEntry>(zip_entry);
FAIL_IF_INVALID_ZIPENTRY(zip_entry_close, zipEntry);
return zipEntry->close();
}
| 0 |
[
"CWE-22"
] |
hhvm
|
65c95a01541dd2fbc9c978ac53bed235b5376686
| 322,195,945,059,960,280,000,000,000,000,000,000,000 | 7 |
ZipArchive::extractTo bug 70350
Summary:Don't allow upward directory traversal when extracting zip archive files.
Files in zip files with `..` or starting at main root `/` should be normalized
to something where the file being extracted winds up within the directory or
a subdirectory where the actual extraction is taking place.
http://git.php.net/?p=php-src.git;a=commit;h=f9c2bf73adb2ede0a486b0db466c264f2b27e0bb
Reviewed By: FBNeal
Differential Revision: D2798452
fb-gh-sync-id: 844549c93e011d1e991bb322bf85822246b04e30
shipit-source-id: 844549c93e011d1e991bb322bf85822246b04e30
|
shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)
{
return alloc_page(gfp | __GFP_ZERO);
}
| 1 |
[
"CWE-200"
] |
linux-2.6
|
e84e2e132c9c66d8498e7710d4ea532d1feaaac5
| 40,898,721,436,560,150,000,000,000,000,000,000,000 | 4 |
tmpfs: restore missing clear_highpage
tmpfs was misconverted to __GFP_ZERO in 2.6.11. There's an unusual case in
which shmem_getpage receives the page from its caller instead of allocating.
We must cover this case by clear_highpage before SetPageUptodate, as before.
Signed-off-by: Hugh Dickins <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
int is_inside_git_dir(void)
{
if (inside_git_dir < 0)
inside_git_dir = is_inside_dir(get_git_dir());
return inside_git_dir;
}
| 0 |
[
"CWE-787"
] |
git
|
3c9d0414ed2db0167e6c828b547be8fc9f88fccc
| 68,752,283,161,530,160,000,000,000,000,000,000,000 | 6 |
Check size of path buffer before writing into it
This prevents a buffer overrun that could otherwise be triggered by
creating a file called '.git' with contents
gitdir: (something really long)
Signed-off-by: Greg Brockman <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
|
TEST(ComparisonsTest, NotEqualFloat) {
ComparisonOpModel model({1, 1, 1, 4}, {1, 1, 1, 4}, TensorType_FLOAT32,
BuiltinOperator_NOT_EQUAL);
model.PopulateTensor<float>(model.input1(), {0.1, 0.9, 0.7, 0.3});
model.PopulateTensor<float>(model.input2(), {0.1, 0.2, 0.6, 0.5});
model.Invoke();
EXPECT_THAT(model.GetOutput(), ElementsAre(false, true, true, true));
EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4));
}
| 0 |
[
"CWE-20",
"CWE-703"
] |
tensorflow
|
a989426ee1346693cc015792f11d715f6944f2b8
| 313,128,124,817,860,500,000,000,000,000,000,000,000 | 10 |
Improve to cover scale value greater than one
PiperOrigin-RevId: 433050921
|
proto_tree_set_vines_tvb(field_info *fi, tvbuff_t *tvb, gint start)
{
proto_tree_set_vines(fi, tvb_get_ptr(tvb, start, FT_VINES_ADDR_LEN));
}
| 0 |
[
"CWE-401"
] |
wireshark
|
a9fc769d7bb4b491efb61c699d57c9f35269d871
| 278,333,221,416,426,540,000,000,000,000,000,000,000 | 4 |
epan: Fix a memory leak.
Make sure _proto_tree_add_bits_ret_val allocates a bits array using the
packet scope, otherwise we leak memory. Fixes #17032.
|
CmdUsersInfo() : Command("usersInfo") {}
| 0 |
[
"CWE-613"
] |
mongo
|
64d8e9e1b12d16b54d6a592bae8110226c491b4e
| 223,537,285,467,178,840,000,000,000,000,000,000,000 | 1 |
SERVER-38984 Validate unique User ID on UserCache hit
(cherry picked from commit e55d6e2292e5dbe2f97153251d8193d1cc89f5d7)
|
sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq )
{
struct net_local *nl;
if( sbni_card_probe( ioaddr ) ) {
release_region( ioaddr, SBNI_IO_EXTENT );
return NULL;
}
outb( 0, ioaddr + CSR0 );
if( irq < 2 ) {
unsigned long irq_mask;
irq_mask = probe_irq_on();
outb( EN_INT | TR_REQ, ioaddr + CSR0 );
outb( PR_RES, ioaddr + CSR1 );
mdelay(50);
irq = probe_irq_off(irq_mask);
outb( 0, ioaddr + CSR0 );
if( !irq ) {
printk( KERN_ERR "%s: can't detect device irq!\n",
dev->name );
release_region( ioaddr, SBNI_IO_EXTENT );
return NULL;
}
} else if( irq == 2 )
irq = 9;
dev->irq = irq;
dev->base_addr = ioaddr;
/* Allocate dev->priv and fill in sbni-specific dev fields. */
nl = dev->priv;
if( !nl ) {
printk( KERN_ERR "%s: unable to get memory!\n", dev->name );
release_region( ioaddr, SBNI_IO_EXTENT );
return NULL;
}
dev->priv = nl;
memset( nl, 0, sizeof(struct net_local) );
spin_lock_init( &nl->lock );
/* store MAC address (generate if that isn't known) */
*(__be16 *)dev->dev_addr = htons( 0x00ff );
*(__be32 *)(dev->dev_addr + 2) = htonl( 0x01000000 |
( (mac[num] ? mac[num] : (u32)((long)dev->priv)) & 0x00ffffff) );
/* store link settings (speed, receive level ) */
nl->maxframe = DEFAULT_FRAME_LEN;
nl->csr1.rate = baud[ num ];
if( (nl->cur_rxl_index = rxl[ num ]) == -1 )
/* autotune rxl */
nl->cur_rxl_index = DEF_RXL,
nl->delta_rxl = DEF_RXL_DELTA;
else
nl->delta_rxl = 0;
nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ];
if( inb( ioaddr + CSR0 ) & 0x01 )
nl->state |= FL_SLOW_MODE;
printk( KERN_NOTICE "%s: ioaddr %#lx, irq %d, "
"MAC: 00:ff:01:%02x:%02x:%02x\n",
dev->name, dev->base_addr, dev->irq,
((u8 *) dev->dev_addr) [3],
((u8 *) dev->dev_addr) [4],
((u8 *) dev->dev_addr) [5] );
printk( KERN_NOTICE "%s: speed %d, receive level ", dev->name,
( (nl->state & FL_SLOW_MODE) ? 500000 : 2000000)
/ (1 << nl->csr1.rate) );
if( nl->delta_rxl == 0 )
printk( "0x%x (fixed)\n", nl->cur_rxl_index );
else
printk( "(auto)\n");
#ifdef CONFIG_SBNI_MULTILINE
nl->master = dev;
nl->link = NULL;
#endif
sbni_cards[ num++ ] = dev;
return dev;
}
| 0 |
[
"CWE-264"
] |
linux-2.6
|
f2455eb176ac87081bbfc9a44b21c7cd2bc1967e
| 180,723,875,653,621,320,000,000,000,000,000,000,000 | 88 |
wan: Missing capability checks in sbni_ioctl()
There are missing capability checks in the following code:
1300 static int
1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd)
1302 {
[...]
1319 case SIOCDEVRESINSTATS :
1320 if( current->euid != 0 ) /* root only */
1321 return -EPERM;
[...]
1336 case SIOCDEVSHWSTATE :
1337 if( current->euid != 0 ) /* root only */
1338 return -EPERM;
[...]
1357 case SIOCDEVENSLAVE :
1358 if( current->euid != 0 ) /* root only */
1359 return -EPERM;
[...]
1372 case SIOCDEVEMANSIPATE :
1373 if( current->euid != 0 ) /* root only */
1374 return -EPERM;
Here's my proposed fix:
Missing capability checks.
Signed-off-by: Eugene Teo <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
const char *am_cache_get_lasso_session(am_cache_entry_t *session)
{
return am_cache_entry_get_string(session, &session->lasso_session);
}
| 0 |
[
"CWE-79"
] |
mod_auth_mellon
|
7af21c53da7bb1de024274ee6da30bc22316a079
| 146,356,419,081,289,360,000,000,000,000,000,000,000 | 4 |
Fix Cross-Site Session Transfer vulnerability
mod_auth_mellon did not verify that the site the session was created
for was the same site as the site the user accessed. This allows an
attacker with access to one web site on a server to use the same
session to get access to a different site running on the same server.
This patch fixes this vulnerability by storing the cookie parameters
used when creating the session in the session, and verifying those
parameters when the session is loaded.
Thanks to François Kooman for reporting this vulnerability.
This vulnerability has been assigned CVE-2017-6807.
|
static inline struct dentry *d_real(struct dentry *dentry)
{
if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
return dentry->d_op->d_real(dentry, NULL);
else
return dentry;
}
| 0 |
[
"CWE-284"
] |
linux
|
54d5ca871e72f2bb172ec9323497f01cd5091ec7
| 117,444,071,704,690,240,000,000,000,000,000,000,000 | 7 |
vfs: add vfs_select_inode() helper
Signed-off-by: Miklos Szeredi <[email protected]>
Cc: <[email protected]> # v4.2+
|
ft_bitmap_draw( FT_Bitmap* bitmap,
int x,
int y,
FTDemo_Display* display,
grColor color)
{
grBitmap gbit;
gbit.width = bitmap->width;
gbit.rows = bitmap->rows;
gbit.pitch = bitmap->pitch;
gbit.buffer = bitmap->buffer;
switch ( bitmap->pixel_mode)
{
case FT_PIXEL_MODE_GRAY:
gbit.mode = gr_pixel_mode_gray;
gbit.grays = 256;
break;
case FT_PIXEL_MODE_MONO:
gbit.mode = gr_pixel_mode_mono;
gbit.grays = 2;
break;
case FT_PIXEL_MODE_LCD:
gbit.mode = gr_pixel_mode_lcd;
gbit.grays = 256;
break;
case FT_PIXEL_MODE_LCD_V:
gbit.mode = gr_pixel_mode_lcdv;
gbit.grays = 256;
break;
default:
return;
}
grBlitGlyphToBitmap( display->bitmap, &gbit, x, y, color );
}
| 0 |
[
"CWE-120"
] |
freetype2-demos
|
b995299b73ba4cd259f221f500d4e63095508bec
| 5,736,568,569,191,048,000,000,000,000,000,000,000 | 40 |
Fix Savannah bug #30054.
* src/ftdiff.c, src/ftgrid.c, src/ftmulti.c, src/ftstring.c,
src/ftview.c: Use precision for `%s' where appropriate to avoid
buffer overflows.
|
aspath_put (struct stream *s, struct aspath *as, int use32bit )
{
struct assegment *seg = as->segments;
size_t bytes = 0;
if (!seg || seg->length == 0)
return 0;
if (seg)
{
/*
* Hey, what do we do when we have > STREAM_WRITABLE(s) here?
* At the moment, we would write out a partial aspath, and our peer
* will complain and drop the session :-/
*
* The general assumption here is that many things tested will
* never happen. And, in real live, up to now, they have not.
*/
while (seg && (ASSEGMENT_LEN(seg, use32bit) <= STREAM_WRITEABLE(s)))
{
struct assegment *next = seg->next;
int written = 0;
int asns_packed = 0;
size_t lenp;
/* Overlength segments have to be split up */
while ( (seg->length - written) > AS_SEGMENT_MAX)
{
assegment_header_put (s, seg->type, AS_SEGMENT_MAX);
assegment_data_put (s, seg->as, AS_SEGMENT_MAX, use32bit);
written += AS_SEGMENT_MAX;
bytes += ASSEGMENT_SIZE (written, use32bit);
}
/* write the final segment, probably is also the first */
lenp = assegment_header_put (s, seg->type, seg->length - written);
assegment_data_put (s, (seg->as + written), seg->length - written,
use32bit);
/* Sequence-type segments can be 'packed' together
* Case of a segment which was overlength and split up
* will be missed here, but that doesn't matter.
*/
while (next && ASSEGMENTS_PACKABLE (seg, next))
{
/* NB: We should never normally get here given we
* normalise aspath data when parse them. However, better
* safe than sorry. We potentially could call
* assegment_normalise here instead, but it's cheaper and
* easier to do it on the fly here rather than go through
* the segment list twice every time we write out
* aspath's.
*/
/* Next segment's data can fit in this one */
assegment_data_put (s, next->as, next->length, use32bit);
/* update the length of the segment header */
stream_putc_at (s, lenp, seg->length - written + next->length);
asns_packed += next->length;
next = next->next;
}
bytes += ASSEGMENT_SIZE (seg->length - written + asns_packed,
use32bit);
seg = next;
}
}
return bytes;
}
| 1 |
[
"CWE-20"
] |
quagga
|
7a42b78be9a4108d98833069a88e6fddb9285008
| 274,037,763,165,412,350,000,000,000,000,000,000,000 | 71 |
bgpd: Fix AS_PATH size calculation for long paths
If you have an AS_PATH with more entries than
what can be written into a single AS_SEGMENT_MAX
it needs to be broken up. The code that noticed
that the AS_PATH needs to be broken up was not
correctly calculating the size of the resulting
message. This patch addresses this issue.
|
struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
const struct in6_addr *final_dst,
bool can_sleep)
{
struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
int err;
dst = ip6_sk_dst_check(sk, dst, fl6);
err = ip6_dst_lookup_tail(sk, &dst, fl6);
if (err)
return ERR_PTR(err);
if (final_dst)
ipv6_addr_copy(&fl6->daddr, final_dst);
if (can_sleep)
fl6->flowi6_flags |= FLOWI_FLAG_CAN_SLEEP;
return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
}
| 0 |
[
"CWE-703"
] |
linux
|
87c48fa3b4630905f98268dde838ee43626a060c
| 180,077,970,956,160,450,000,000,000,000,000,000,000 | 19 |
ipv6: make fragment identifications less predictable
IPv6 fragment identification generation is way beyond what we use for
IPv4 : It uses a single generator. Its not scalable and allows DOS
attacks.
Now inetpeer is IPv6 aware, we can use it to provide a more secure and
scalable frag ident generator (per destination, instead of system wide)
This patch :
1) defines a new secure_ipv6_id() helper
2) extends inet_getid() to provide 32bit results
3) extends ipv6_select_ident() with a new dest parameter
Reported-by: Fernando Gont <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
png_write_chunk_start(png_structrp png_ptr, png_const_bytep chunk_string,
png_uint_32 length)
{
png_write_chunk_header(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), length);
}
| 0 |
[
"CWE-120"
] |
libpng
|
81f44665cce4cb1373f049a76f3904e981b7a766
| 278,828,253,770,319,730,000,000,000,000,000,000,000 | 5 |
[libpng16] Reject attempt to write over-length PLTE chunk
|
njs_string_prototype_to_bytes(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
u_char *p;
size_t length;
uint32_t byte;
njs_int_t ret;
const u_char *s, *end;
njs_slice_prop_t slice;
njs_string_prop_t string;
njs_unicode_decode_t ctx;
ret = njs_string_object_validate(vm, njs_argument(args, 0));
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
ret = njs_string_slice_prop(vm, &string, &slice, args, nargs);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
if (string.length == 0) {
/* Byte string. */
return njs_string_slice(vm, &vm->retval, &string, &slice);
}
p = njs_string_alloc(vm, &vm->retval, slice.length, 0);
if (njs_fast_path(p != NULL)) {
if (string.length != string.size) {
/* UTF-8 string. */
end = string.start + string.size;
s = njs_string_offset(string.start, end, slice.start);
length = slice.length;
njs_utf8_decode_init(&ctx);
while (length != 0 && s < end) {
byte = njs_utf8_decode(&ctx, &s, end);
if (njs_slow_path(byte > 0xFF)) {
njs_release(vm, &vm->retval);
vm->retval = njs_value_null;
return NJS_OK;
}
*p++ = (u_char) byte;
length--;
}
} else {
/* ASCII string. */
memcpy(p, string.start + slice.start, slice.length);
}
return NJS_OK;
}
return NJS_ERROR;
}
| 0 |
[] |
njs
|
36f04a3178fcb6da8513cc3dbf35215c2a581b3f
| 280,729,215,165,985,880,000,000,000,000,000,000,000 | 65 |
Fixed String.prototype.replace() with byte strings.
This closes #522 issue on Github.
|
static void wq_watchdog_set_thresh(unsigned long thresh)
{
wq_watchdog_thresh = 0;
del_timer_sync(&wq_watchdog_timer);
if (thresh) {
wq_watchdog_thresh = thresh;
wq_watchdog_reset_touched();
mod_timer(&wq_watchdog_timer, jiffies + thresh * HZ);
}
}
| 0 |
[
"CWE-200"
] |
tip
|
dfb4357da6ddbdf57d583ba64361c9d792b0e0b1
| 9,238,670,972,094,906,000,000,000,000,000,000,000 | 11 |
time: Remove CONFIG_TIMER_STATS
Currently CONFIG_TIMER_STATS exposes process information across namespaces:
kernel/time/timer_list.c print_timer():
SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
/proc/timer_list:
#11: <0000000000000000>, hrtimer_wakeup, S:01, do_nanosleep, cron/2570
Given that the tracer can give the same information, this patch entirely
removes CONFIG_TIMER_STATS.
Suggested-by: Thomas Gleixner <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Acked-by: John Stultz <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: [email protected]
Cc: Lai Jiangshan <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Xing Gao <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Jessica Frazelle <[email protected]>
Cc: [email protected]
Cc: Nicolas Iooss <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Olof Johansson <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: Arjan van de Ven <[email protected]>
Link: http://lkml.kernel.org/r/20170208192659.GA32582@beast
Signed-off-by: Thomas Gleixner <[email protected]>
|
static void dump_monitored_desktop(wLog* log, const char* msg, const WINDOW_ORDER_INFO* orderInfo,
const MONITORED_DESKTOP_ORDER* monitored)
{
char buffer[1000] = { 0 };
const size_t bufferSize = sizeof(buffer) - 1;
DUMP_APPEND(buffer, bufferSize, "%s", msg);
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND)
DUMP_APPEND(buffer, bufferSize, " activeWindowId=0x%" PRIx32 "", monitored->activeWindowId);
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
{
UINT32 i;
DUMP_APPEND(buffer, bufferSize, " windows=(");
for (i = 0; i < monitored->numWindowIds; i++)
{
DUMP_APPEND(buffer, bufferSize, "0x%" PRIx32 ",", monitored->windowIds[i]);
}
DUMP_APPEND(buffer, bufferSize, ")");
}
WLog_Print(log, WLOG_DEBUG, buffer);
}
| 0 |
[
"CWE-125"
] |
FreeRDP
|
6b2bc41935e53b0034fe5948aeeab4f32e80f30f
| 165,621,419,555,848,500,000,000,000,000,000,000,000 | 24 |
Fix #6010: Check length in read_icon_info
|
sort_keyuse(KEYUSE *a,KEYUSE *b)
{
int res;
if (a->table->tablenr != b->table->tablenr)
return (int) (a->table->tablenr - b->table->tablenr);
if (a->key != b->key)
return (int) (a->key - b->key);
if (a->key == MAX_KEY && b->key == MAX_KEY &&
a->used_tables != b->used_tables)
return (int) ((ulong) a->used_tables - (ulong) b->used_tables);
if (a->keypart != b->keypart)
return (int) (a->keypart - b->keypart);
// Place const values before other ones
if ((res= MY_TEST((a->used_tables & ~OUTER_REF_TABLE_BIT)) -
MY_TEST((b->used_tables & ~OUTER_REF_TABLE_BIT))))
return res;
/* Place rows that are not 'OPTIMIZE_REF_OR_NULL' first */
return (int) ((a->optimize & KEY_OPTIMIZE_REF_OR_NULL) -
(b->optimize & KEY_OPTIMIZE_REF_OR_NULL));
}
| 0 |
[] |
server
|
ff77a09bda884fe6bf3917eb29b9d3a2f53f919b
| 88,001,393,099,704,900,000,000,000,000,000,000,000 | 20 |
MDEV-22464 Server crash on UPDATE with nested subquery
Uninitialized ref_pointer_array[] because setup_fields() got empty
fields list. mysql_multi_update() for some reason does that by
substituting the fields list with empty total_list for the
mysql_select() call (looks like wrong merge since total_list is not
used anywhere else and is always empty). The fix would be to return
back the original fields list. But this fails update_use_source.test
case:
--error ER_BAD_FIELD_ERROR
update v1 set t1c1=2 order by 1;
Actually not failing the above seems to be ok.
The other fix would be to keep resolve_in_select_list false (and that
keeps outer context from being resolved in
Item_ref::fix_fields()). This fix is more consistent with how SELECT
behaves:
--error ER_SUBQUERY_NO_1_ROW
select a from t1 where a= (select 2 from t1 having (a = 3));
So this patch implements this fix.
|
BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
{
BN_ULONG c,l,t;
assert(n >= 0);
if (n <= 0) return((BN_ULONG)0);
c=0;
#ifndef OPENSSL_SMALL_FOOTPRINT
while (n&~3)
{
t=a[0];
t=(t+c)&BN_MASK2;
c=(t < c);
l=(t+b[0])&BN_MASK2;
c+=(l < t);
r[0]=l;
t=a[1];
t=(t+c)&BN_MASK2;
c=(t < c);
l=(t+b[1])&BN_MASK2;
c+=(l < t);
r[1]=l;
t=a[2];
t=(t+c)&BN_MASK2;
c=(t < c);
l=(t+b[2])&BN_MASK2;
c+=(l < t);
r[2]=l;
t=a[3];
t=(t+c)&BN_MASK2;
c=(t < c);
l=(t+b[3])&BN_MASK2;
c+=(l < t);
r[3]=l;
a+=4; b+=4; r+=4; n-=4;
}
#endif
while(n)
{
t=a[0];
t=(t+c)&BN_MASK2;
c=(t < c);
l=(t+b[0])&BN_MASK2;
c+=(l < t);
r[0]=l;
a++; b++; r++; n--;
}
return((BN_ULONG)c);
}
| 0 |
[
"CWE-310"
] |
openssl
|
a7a44ba55cb4f884c6bc9ceac90072dea38e66d0
| 87,506,246,345,884,100,000,000,000,000,000,000,000 | 50 |
Fix for CVE-2014-3570 (with minor bn_asm.c revamp).
Reviewed-by: Emilia Kasper <[email protected]>
|
static bool isCharacterAlphanumeric(UChar32 testChar) {
return iswalnum(testChar);
}
| 0 |
[
"CWE-200"
] |
mongo
|
035cf2afc04988b22cb67f4ebfd77e9b344cb6e0
| 339,479,065,556,871,400,000,000,000,000,000,000,000 | 3 |
SERVER-25335 avoid group and other permissions when creating .dbshell history file
|
struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig,
const struct flowi *fl,
const struct sock *sk, int flags)
{
struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk,
flags | XFRM_LOOKUP_QUEUE |
XFRM_LOOKUP_KEEP_DST_REF);
if (PTR_ERR(dst) == -EREMOTE)
return make_blackhole(net, dst_orig->ops->family, dst_orig);
if (IS_ERR(dst))
dst_release(dst_orig);
return dst;
}
| 0 |
[
"CWE-703"
] |
linux
|
f85daf0e725358be78dfd208dea5fd665d8cb901
| 270,708,567,001,331,300,000,000,000,000,000,000,000 | 16 |
xfrm: xfrm_policy: fix a possible double xfrm_pols_put() in xfrm_bundle_lookup()
xfrm_policy_lookup() will call xfrm_pol_hold_rcu() to get a refcount of
pols[0]. This refcount can be dropped in xfrm_expand_policies() when
xfrm_expand_policies() return error. pols[0]'s refcount is balanced in
here. But xfrm_bundle_lookup() will also call xfrm_pols_put() with
num_pols == 1 to drop this refcount when xfrm_expand_policies() return
error.
This patch also fix an illegal address access. pols[0] will save a error
point when xfrm_policy_lookup fails. This lead to xfrm_pols_put to resolve
an illegal address in xfrm_bundle_lookup's error path.
Fix these by setting num_pols = 0 in xfrm_expand_policies()'s error path.
Fixes: 80c802f3073e ("xfrm: cache bundles instead of policies for outgoing flows")
Signed-off-by: Hangyu Hua <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
|
TRIO_PRIVATE BOOLEAN_T TrioReadDouble TRIO_ARGS4((self, target, flags, width), trio_class_t* self,
trio_pointer_t target, trio_flags_t flags,
int width)
{
int ch;
char doubleString[512];
int offset = 0;
int start;
#if TRIO_FEATURE_QUOTE
int j;
#endif
BOOLEAN_T isHex = FALSE;
trio_long_double_t infinity;
doubleString[0] = 0;
if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1))
width = sizeof(doubleString) - 1;
TrioSkipWhitespaces(self);
/*
* Read entire double number from stream. trio_to_double requires
* a string as input, but InStream can be anything, so we have to
* collect all characters.
*/
ch = self->current;
if ((ch == '+') || (ch == '-'))
{
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
width--;
}
start = offset;
switch (ch)
{
case 'n':
case 'N':
/* Not-a-number */
if (offset != 0)
break;
/* FALLTHROUGH */
case 'i':
case 'I':
/* Infinity */
while (isalpha(ch) && (offset - start < width))
{
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
}
doubleString[offset] = NIL;
/* Case insensitive string comparison */
if (trio_equal(&doubleString[start], INFINITE_UPPER) ||
trio_equal(&doubleString[start], LONG_INFINITE_UPPER))
{
infinity = ((start == 1) && (doubleString[0] == '-')) ? trio_ninf() : trio_pinf();
if (!target)
return FALSE;
if (flags & FLAGS_LONGDOUBLE)
{
*((trio_long_double_t*)target) = infinity;
}
else if (flags & FLAGS_LONG)
{
*((double*)target) = infinity;
}
else
{
*((float*)target) = infinity;
}
return TRUE;
}
if (trio_equal(doubleString, NAN_UPPER))
{
if (!target)
return FALSE;
/* NaN must not have a preceeding + nor - */
if (flags & FLAGS_LONGDOUBLE)
{
*((trio_long_double_t*)target) = trio_nan();
}
else if (flags & FLAGS_LONG)
{
*((double*)target) = trio_nan();
}
else
{
*((float*)target) = trio_nan();
}
return TRUE;
}
return FALSE;
case '0':
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
if (trio_to_upper(ch) == 'X')
{
isHex = TRUE;
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
}
break;
default:
break;
}
while ((ch != EOF) && (offset - start < width))
{
/* Integer part */
if (isHex ? isxdigit(ch) : isdigit(ch))
{
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
}
#if TRIO_FEATURE_QUOTE
else if (flags & FLAGS_QUOTE)
{
/* Compare with thousands separator */
for (j = 0; internalThousandSeparator[j] && self->current; j++)
{
if (internalThousandSeparator[j] != self->current)
break;
self->InStream(self, &ch);
}
if (internalThousandSeparator[j])
break; /* Mismatch */
else
continue; /* Match */
}
#endif
else
break; /* while */
}
if (ch == '.')
{
/* Decimal part */
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
while ((isHex ? isxdigit(ch) : isdigit(ch)) && (offset - start < width))
{
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
}
}
if (isHex ? (trio_to_upper(ch) == 'P') : (trio_to_upper(ch) == 'E'))
{
/* Exponent */
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
if ((ch == '+') || (ch == '-'))
{
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
}
while (isdigit(ch) && (offset - start < width))
{
doubleString[offset++] = (char)ch;
self->InStream(self, &ch);
}
}
if ((offset == start) || (*doubleString == NIL))
return FALSE;
doubleString[offset] = 0;
if (flags & FLAGS_LONGDOUBLE)
{
if (!target)
return FALSE;
*((trio_long_double_t*)target) = trio_to_long_double(doubleString, NULL);
}
else if (flags & FLAGS_LONG)
{
if (!target)
return FALSE;
*((double*)target) = trio_to_double(doubleString, NULL);
}
else
{
if (!target)
return FALSE;
*((float*)target) = trio_to_float(doubleString, NULL);
}
return TRUE;
}
| 0 |
[
"CWE-190",
"CWE-125"
] |
FreeRDP
|
05cd9ea2290d23931f615c1b004d4b2e69074e27
| 336,150,797,291,053,700,000,000,000,000,000,000,000 | 196 |
Fixed TrioParse and trio_length limts.
CVE-2020-4030 thanks to @antonio-morales for finding this.
|
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
{
uint count=0;
MYSQL_BIND *param, *end;
DBUG_ENTER("mysql_stmt_bind_param");
if (!stmt->param_count)
{
if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE)
{
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate, NULL);
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
/* Allocated on prepare */
memcpy((char*) stmt->params, (char*) my_bind,
sizeof(MYSQL_BIND) * stmt->param_count);
for (param= stmt->params, end= param+stmt->param_count;
param < end ;
param++)
{
param->param_number= count++;
param->long_data_used= 0;
/* If param->is_null is not set, then the value can never be NULL */
if (!param->is_null)
param->is_null= &int_is_null_false;
/* Setup data copy functions for the different supported types */
switch (param->buffer_type) {
case MYSQL_TYPE_NULL:
param->is_null= &int_is_null_true;
break;
case MYSQL_TYPE_TINY:
/* Force param->length as this is fixed for this type */
param->length= ¶m->buffer_length;
param->buffer_length= 1;
param->store_param_func= store_param_tinyint;
break;
case MYSQL_TYPE_SHORT:
param->length= ¶m->buffer_length;
param->buffer_length= 2;
param->store_param_func= store_param_short;
break;
case MYSQL_TYPE_LONG:
param->length= ¶m->buffer_length;
param->buffer_length= 4;
param->store_param_func= store_param_int32;
break;
case MYSQL_TYPE_LONGLONG:
param->length= ¶m->buffer_length;
param->buffer_length= 8;
param->store_param_func= store_param_int64;
break;
case MYSQL_TYPE_FLOAT:
param->length= ¶m->buffer_length;
param->buffer_length= 4;
param->store_param_func= store_param_float;
break;
case MYSQL_TYPE_DOUBLE:
param->length= ¶m->buffer_length;
param->buffer_length= 8;
param->store_param_func= store_param_double;
break;
case MYSQL_TYPE_TIME:
param->store_param_func= store_param_time;
param->buffer_length= MAX_TIME_REP_LENGTH;
break;
case MYSQL_TYPE_DATE:
param->store_param_func= store_param_date;
param->buffer_length= MAX_DATE_REP_LENGTH;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->store_param_func= store_param_datetime;
param->buffer_length= MAX_DATETIME_REP_LENGTH;
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
param->store_param_func= store_param_str;
/*
For variable length types user must set either length or
buffer_length.
*/
break;
default:
strmov(stmt->sqlstate, unknown_sqlstate);
sprintf(stmt->last_error,
ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE),
param->buffer_type, count);
DBUG_RETURN(1);
}
/*
If param->length is not given, change it to point to buffer_length.
This way we can always use *param->length to get the length of data
*/
if (!param->length)
param->length= ¶m->buffer_length;
}
/* We have to send/resend type information to MySQL */
stmt->send_types_to_server= TRUE;
stmt->bind_param_done= TRUE;
DBUG_RETURN(0);
}
| 0 |
[] |
mysql-server
|
3d8134d2c9b74bc8883ffe2ef59c168361223837
| 295,349,791,387,584,060,000,000,000,000,000,000,000 | 114 |
Bug#25988681: USE-AFTER-FREE IN MYSQL_STMT_CLOSE()
Description: If mysql_stmt_close() encountered error,
it recorded error in prepared statement
but then frees memory assigned to prepared
statement. If mysql_stmt_error() is used
to get error information, it will result
into use after free.
In all cases where mysql_stmt_close() can
fail, error would have been set by
cli_advanced_command in MYSQL structure.
Solution: Don't copy error from MYSQL using set_stmt_errmsg.
There is no automated way to test the fix since
it is in mysql_stmt_close() which does not expect
any reply from server.
Reviewed-By: Georgi Kodinov <[email protected]>
Reviewed-By: Ramil Kalimullin <[email protected]>
|
nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
enum nfp_flower_cmsg_port_vnic_type vnic_type,
enum nfp_repr_type repr_type, unsigned int cnt)
{
u8 nfp_pcie = nfp_cppcore_pcie_unit(app->pf->cpp);
struct nfp_flower_priv *priv = app->priv;
atomic_t *replies = &priv->reify_replies;
struct nfp_flower_repr_priv *repr_priv;
enum nfp_port_type port_type;
struct nfp_repr *nfp_repr;
struct nfp_reprs *reprs;
int i, err, reify_cnt;
const u8 queue = 0;
port_type = repr_type == NFP_REPR_TYPE_PF ? NFP_PORT_PF_PORT :
NFP_PORT_VF_PORT;
reprs = nfp_reprs_alloc(cnt);
if (!reprs)
return -ENOMEM;
for (i = 0; i < cnt; i++) {
struct net_device *repr;
struct nfp_port *port;
u32 port_id;
repr = nfp_repr_alloc(app);
if (!repr) {
err = -ENOMEM;
goto err_reprs_clean;
}
repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL);
if (!repr_priv) {
err = -ENOMEM;
nfp_repr_free(repr);
goto err_reprs_clean;
}
nfp_repr = netdev_priv(repr);
nfp_repr->app_priv = repr_priv;
repr_priv->nfp_repr = nfp_repr;
/* For now we only support 1 PF */
WARN_ON(repr_type == NFP_REPR_TYPE_PF && i);
port = nfp_port_alloc(app, port_type, repr);
if (IS_ERR(port)) {
err = PTR_ERR(port);
kfree(repr_priv);
nfp_repr_free(repr);
goto err_reprs_clean;
}
if (repr_type == NFP_REPR_TYPE_PF) {
port->pf_id = i;
port->vnic = priv->nn->dp.ctrl_bar;
} else {
port->pf_id = 0;
port->vf_id = i;
port->vnic =
app->pf->vf_cfg_mem + i * NFP_NET_CFG_BAR_SZ;
}
eth_hw_addr_random(repr);
port_id = nfp_flower_cmsg_pcie_port(nfp_pcie, vnic_type,
i, queue);
err = nfp_repr_init(app, repr,
port_id, port, priv->nn->dp.netdev);
if (err) {
kfree(repr_priv);
nfp_port_free(port);
nfp_repr_free(repr);
goto err_reprs_clean;
}
RCU_INIT_POINTER(reprs->reprs[i], repr);
nfp_info(app->cpp, "%s%d Representor(%s) created\n",
repr_type == NFP_REPR_TYPE_PF ? "PF" : "VF", i,
repr->name);
}
nfp_app_reprs_set(app, repr_type, reprs);
atomic_set(replies, 0);
reify_cnt = nfp_flower_reprs_reify(app, repr_type, true);
if (reify_cnt < 0) {
err = reify_cnt;
nfp_warn(app->cpp, "Failed to notify firmware about repr creation\n");
goto err_reprs_remove;
}
err = nfp_flower_wait_repr_reify(app, replies, reify_cnt);
if (err)
goto err_reprs_remove;
return 0;
err_reprs_remove:
reprs = nfp_app_reprs_set(app, repr_type, NULL);
err_reprs_clean:
nfp_reprs_clean_and_free(app, reprs);
return err;
}
| 0 |
[
"CWE-400",
"CWE-401"
] |
linux
|
8ce39eb5a67aee25d9f05b40b673c95b23502e3e
| 322,785,904,662,815,830,000,000,000,000,000,000,000 | 103 |
nfp: flower: fix memory leak in nfp_flower_spawn_vnic_reprs
In nfp_flower_spawn_vnic_reprs in the loop if initialization or the
allocations fail memory is leaked. Appropriate releases are added.
Fixes: b94524529741 ("nfp: flower: add per repr private data for LAG offload")
Signed-off-by: Navid Emamdoost <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
http_register_tls_ca (const char *fname)
{
strlist_t sl;
if (!fname)
{
free_strlist (tls_ca_certlist);
tls_ca_certlist = NULL;
}
else
{
/* Warn if we can't access right now, but register it anyway in
case it becomes accessible later */
if (access (fname, F_OK))
log_info (_("can't access '%s': %s\n"), fname,
gpg_strerror (gpg_error_from_syserror()));
sl = add_to_strlist (&tls_ca_certlist, fname);
if (*sl->d && !strcmp (sl->d + strlen (sl->d) - 4, ".pem"))
sl->flags = 1;
}
}
| 0 |
[
"CWE-352"
] |
gnupg
|
4a4bb874f63741026bd26264c43bb32b1099f060
| 240,557,108,440,873,500,000,000,000,000,000,000,000 | 21 |
dirmngr: Avoid possible CSRF attacks via http redirects.
* dirmngr/http.h (parsed_uri_s): Add fields off_host and off_path.
(http_redir_info_t): New.
* dirmngr/http.c (do_parse_uri): Set new fields.
(same_host_p): New.
(http_prepare_redirect): New.
* dirmngr/t-http-basic.c: New test.
* dirmngr/ks-engine-hkp.c (send_request): Use http_prepare_redirect
instead of the open code.
* dirmngr/ks-engine-http.c (ks_http_fetch): Ditto.
--
With this change a http query will not follow a redirect unless the
Location header gives the same host. If the host is different only
the host and port is taken from the Location header and the original
path and query parts are kept.
Signed-off-by: Werner Koch <[email protected]>
(cherry picked from commit fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144)
|
enum_field_types real_type() const
{
return MYSQL_TYPE_BLOB;
}
| 0 |
[
"CWE-416",
"CWE-703"
] |
server
|
08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917
| 90,264,182,854,994,420,000,000,000,000,000,000,000 | 4 |
MDEV-24176 Server crashes after insert in the table with virtual
column generated using date_format() and if()
vcol_info->expr is allocated on expr_arena at parsing stage. Since
expr item is allocated on expr_arena all its containee items must be
allocated on expr_arena too. Otherwise fix_session_expr() will
encounter prematurely freed item.
When table is reopened from cache vcol_info contains stale
expression. We refresh expression via TABLE::vcol_fix_exprs() but
first we must prepare a proper context (Vcol_expr_context) which meets
some requirements:
1. As noted above expr update must be done on expr_arena as there may
be new items created. It was a bug in fix_session_expr_for_read() and
was just not reproduced because of no second refix. Now refix is done
for more cases so it does reproduce. Tests affected: vcol.binlog
2. Also name resolution context must be narrowed to the single table.
Tested by: vcol.update main.default vcol.vcol_syntax gcol.gcol_bugfixes
3. sql_mode must be clean and not fail expr update.
sql_mode such as MODE_NO_BACKSLASH_ESCAPES, MODE_NO_ZERO_IN_DATE, etc
must not affect vcol expression update. If the table was created
successfully any further evaluation must not fail. Tests affected:
main.func_like
Reviewed by: Sergei Golubchik <[email protected]>
|
static CURLcode ossl_connect_common(struct Curl_easy *data,
struct connectdata *conn,
int sockindex,
bool nonblocking,
bool *done)
{
CURLcode result;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
curl_socket_t sockfd = conn->sock[sockindex];
int what;
/* check if the connection has already been established */
if(ssl_connection_complete == connssl->state) {
*done = TRUE;
return CURLE_OK;
}
if(ssl_connect_1 == connssl->connecting_state) {
/* Find out how much more time we're allowed */
const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
failf(data, "SSL connection timeout");
return CURLE_OPERATION_TIMEDOUT;
}
result = ossl_connect_step1(data, conn, sockindex);
if(result)
return result;
}
while(ssl_connect_2 == connssl->connecting_state ||
ssl_connect_2_reading == connssl->connecting_state ||
ssl_connect_2_writing == connssl->connecting_state) {
/* check allowed time left */
const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
failf(data, "SSL connection timeout");
return CURLE_OPERATION_TIMEDOUT;
}
/* if ssl is expecting something, check if it's available. */
if(connssl->connecting_state == ssl_connect_2_reading ||
connssl->connecting_state == ssl_connect_2_writing) {
curl_socket_t writefd = ssl_connect_2_writing ==
connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
curl_socket_t readfd = ssl_connect_2_reading ==
connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
nonblocking?0:timeout_ms);
if(what < 0) {
/* fatal error */
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
return CURLE_SSL_CONNECT_ERROR;
}
if(0 == what) {
if(nonblocking) {
*done = FALSE;
return CURLE_OK;
}
/* timeout */
failf(data, "SSL connection timeout");
return CURLE_OPERATION_TIMEDOUT;
}
/* socket is readable or writable */
}
/* Run transaction, and return to the caller if it failed or if this
* connection is done nonblocking and this loop would execute again. This
* permits the owner of a multi handle to abort a connection attempt
* before step2 has completed while ensuring that a client using select()
* or epoll() will always have a valid fdset to wait on.
*/
result = ossl_connect_step2(data, conn, sockindex);
if(result || (nonblocking &&
(ssl_connect_2 == connssl->connecting_state ||
ssl_connect_2_reading == connssl->connecting_state ||
ssl_connect_2_writing == connssl->connecting_state)))
return result;
} /* repeat step2 until all transactions are done. */
if(ssl_connect_3 == connssl->connecting_state) {
result = ossl_connect_step3(data, conn, sockindex);
if(result)
return result;
}
if(ssl_connect_done == connssl->connecting_state) {
connssl->state = ssl_connection_complete;
conn->recv[sockindex] = ossl_recv;
conn->send[sockindex] = ossl_send;
*done = TRUE;
}
else
*done = FALSE;
/* Reset our connect state machine */
connssl->connecting_state = ssl_connect_1;
return CURLE_OK;
}
| 0 |
[
"CWE-290"
] |
curl
|
b09c8ee15771c614c4bf3ddac893cdb12187c844
| 85,986,943,489,672,880,000,000,000,000,000,000,000 | 108 |
vtls: add 'isproxy' argument to Curl_ssl_get/addsessionid()
To make sure we set and extract the correct session.
Reported-by: Mingtao Yang
Bug: https://curl.se/docs/CVE-2021-22890.html
CVE-2021-22890
|
sec_sign(uint8 * signature, int siglen, uint8 * session_key, int keylen, uint8 * data, int datalen)
{
uint8 shasig[20];
uint8 md5sig[16];
uint8 lenhdr[4];
RDSSL_SHA1 sha1;
RDSSL_MD5 md5;
buf_out_uint32(lenhdr, datalen);
rdssl_sha1_init(&sha1);
rdssl_sha1_update(&sha1, session_key, keylen);
rdssl_sha1_update(&sha1, pad_54, 40);
rdssl_sha1_update(&sha1, lenhdr, 4);
rdssl_sha1_update(&sha1, data, datalen);
rdssl_sha1_final(&sha1, shasig);
rdssl_md5_init(&md5);
rdssl_md5_update(&md5, session_key, keylen);
rdssl_md5_update(&md5, pad_92, 48);
rdssl_md5_update(&md5, shasig, 20);
rdssl_md5_final(&md5, md5sig);
memcpy(signature, md5sig, siglen);
}
| 0 |
[
"CWE-787"
] |
rdesktop
|
766ebcf6f23ccfe8323ac10242ae6e127d4505d2
| 123,014,158,731,098,580,000,000,000,000,000,000,000 | 25 |
Malicious RDP server security fixes
This commit includes fixes for a set of 21 vulnerabilities in
rdesktop when a malicious RDP server is used.
All vulnerabilities was identified and reported by Eyal Itkin.
* Add rdp_protocol_error function that is used in several fixes
* Refactor of process_bitmap_updates
* Fix possible integer overflow in s_check_rem() on 32bit arch
* Fix memory corruption in process_bitmap_data - CVE-2018-8794
* Fix remote code execution in process_bitmap_data - CVE-2018-8795
* Fix remote code execution in process_plane - CVE-2018-8797
* Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175
* Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175
* Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176
* Fix Denial of Service in sec_recv - CVE-2018-20176
* Fix minor information leak in rdpdr_process - CVE-2018-8791
* Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792
* Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793
* Fix Denial of Service in process_bitmap_data - CVE-2018-8796
* Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798
* Fix Denial of Service in process_secondary_order - CVE-2018-8799
* Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800
* Fix major information leak in ui_clip_handle_data - CVE-2018-20174
* Fix memory corruption in rdp_in_unistr - CVE-2018-20177
* Fix Denial of Service in process_demand_active - CVE-2018-20178
* Fix remote code execution in lspci_process - CVE-2018-20179
* Fix remote code execution in rdpsnddbg_process - CVE-2018-20180
* Fix remote code execution in seamless_process - CVE-2018-20181
* Fix remote code execution in seamless_process_line - CVE-2018-20182
|
static int check_nonce(request_rec *r, digest_header_rec *resp,
const digest_config_rec *conf)
{
apr_time_t dt;
time_rec nonce_time;
char tmp, hash[NONCE_HASH_LEN+1];
/* Since the time part of the nonce is a base64 encoding of an
* apr_time_t (8 bytes), it should end with a '=', fail early otherwise.
*/
if (strlen(resp->nonce) != NONCE_LEN
|| resp->nonce[NONCE_TIME_LEN - 1] != '=') {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01775)
"invalid nonce '%s' received - length is not %d "
"or time encoding is incorrect",
resp->nonce, NONCE_LEN);
note_digest_auth_failure(r, conf, resp, 1);
return HTTP_UNAUTHORIZED;
}
tmp = resp->nonce[NONCE_TIME_LEN];
resp->nonce[NONCE_TIME_LEN] = '\0';
apr_base64_decode_binary(nonce_time.arr, resp->nonce);
gen_nonce_hash(hash, resp->nonce, resp->opaque, r->server, conf);
resp->nonce[NONCE_TIME_LEN] = tmp;
resp->nonce_time = nonce_time.time;
if (strcmp(hash, resp->nonce+NONCE_TIME_LEN)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01776)
"invalid nonce %s received - hash is not %s",
resp->nonce, hash);
note_digest_auth_failure(r, conf, resp, 1);
return HTTP_UNAUTHORIZED;
}
dt = r->request_time - nonce_time.time;
if (conf->nonce_lifetime > 0 && dt < 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01777)
"invalid nonce %s received - user attempted "
"time travel", resp->nonce);
note_digest_auth_failure(r, conf, resp, 1);
return HTTP_UNAUTHORIZED;
}
if (conf->nonce_lifetime > 0) {
if (dt > conf->nonce_lifetime) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0,r, APLOGNO(01778)
"user %s: nonce expired (%.2f seconds old "
"- max lifetime %.2f) - sending new nonce",
r->user, (double)apr_time_sec(dt),
(double)apr_time_sec(conf->nonce_lifetime));
note_digest_auth_failure(r, conf, resp, 1);
return HTTP_UNAUTHORIZED;
}
}
else if (conf->nonce_lifetime == 0 && resp->client) {
if (memcmp(resp->client->last_nonce, resp->nonce, NONCE_LEN)) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(01779)
"user %s: one-time-nonce mismatch - sending "
"new nonce", r->user);
note_digest_auth_failure(r, conf, resp, 1);
return HTTP_UNAUTHORIZED;
}
}
/* else (lifetime < 0) => never expires */
return OK;
}
| 0 |
[
"CWE-787"
] |
httpd
|
3b6431eb9c9dba603385f70a2131ab4a01bf0d3b
| 134,711,086,718,727,520,000,000,000,000,000,000,000 | 68 |
Merge r1885659 from trunk:
mod_auth_digest: Fast validation of the nonce's base64 to fail early if
the format can't match anyway.
Submitted by: ylavic
Reviewed by: ylavic, covener, jailletc36
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1885666 13f79535-47bb-0310-9956-ffa450edef68
|
static ssize_t portio_porttype_show(struct uio_port *port, char *buf)
{
const char *porttypes[] = {"none", "x86", "gpio", "other"};
if ((port->porttype < 0) || (port->porttype > UIO_PORT_OTHER))
return -EINVAL;
return sprintf(buf, "port_%s\n", porttypes[port->porttype]);
}
| 0 |
[
"CWE-119",
"CWE-189",
"CWE-703"
] |
linux
|
7314e613d5ff9f0934f7a0f74ed7973b903315d1
| 328,313,084,801,285,800,000,000,000,000,000,000,000 | 9 |
Fix a few incorrectly checked [io_]remap_pfn_range() calls
Nico Golde reports a few straggling uses of [io_]remap_pfn_range() that
really should use the vm_iomap_memory() helper. This trivially converts
two of them to the helper, and comments about why the third one really
needs to continue to use remap_pfn_range(), and adds the missing size
check.
Reported-by: Nico Golde <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected].
|
static inline void qeth_free_cq(struct qeth_card *card)
{
if (card->qdio.c_q) {
--card->qdio.no_in_queues;
kfree(card->qdio.c_q);
card->qdio.c_q = NULL;
}
kfree(card->qdio.out_bufstates);
card->qdio.out_bufstates = NULL;
}
| 0 |
[
"CWE-200",
"CWE-119"
] |
linux
|
6fb392b1a63ae36c31f62bc3fc8630b49d602b62
| 27,947,761,380,738,040,000,000,000,000,000,000,000 | 10 |
qeth: avoid buffer overflow in snmp ioctl
Check user-defined length in snmp ioctl request and allow request
only if it fits into a qeth command buffer.
Signed-off-by: Ursula Braun <[email protected]>
Signed-off-by: Frank Blaschka <[email protected]>
Reviewed-by: Heiko Carstens <[email protected]>
Reported-by: Nico Golde <[email protected]>
Reported-by: Fabian Yamaguchi <[email protected]>
Cc: <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
BSONObj DocumentSourceMatch::getQuery() const {
return _predicate;
}
| 0 |
[] |
mongo
|
b3107d73a2c58d7e016b834dae0acfd01c0db8d7
| 52,389,440,677,690,840,000,000,000,000,000,000,000 | 3 |
SERVER-59299: Flatten top-level nested $match stages in doOptimizeAt
(cherry picked from commit 4db5eceda2cff697f35c84cd08232bac8c33beec)
|
void EvalNamedColor(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage *mpe)
{
cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) mpe ->Data;
cmsUInt16Number index = (cmsUInt16Number) _cmsQuickSaturateWord(In[0] * 65535.0);
cmsUInt32Number j;
if (index >= NamedColorList-> nColors) {
cmsSignalError(NamedColorList ->ContextID, cmsERROR_RANGE, "Color %d out of range; ignored", index);
}
else {
for (j=0; j < NamedColorList ->ColorantCount; j++)
Out[j] = (cmsFloat32Number) (NamedColorList->List[index].DeviceColorant[j] / 65535.0);
}
}
| 0 |
[] |
Little-CMS
|
886e2f524268efe8a1c3aa838c28e446fda24486
| 42,892,580,444,053,940,000,000,000,000,000,000,000 | 14 |
Fixes from coverity check
|
static void edge_break(struct tty_struct *tty, int break_state)
{
struct usb_serial_port *port = tty->driver_data;
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
int status;
int bv = 0; /* Off */
/* chase the port close */
chase_port(edge_port, 0, 0);
if (break_state == -1)
bv = 1; /* On */
status = ti_do_config(edge_port, UMPC_SET_CLR_BREAK, bv);
if (status)
dev_dbg(&port->dev, "%s - error %d sending break set/clear command.\n",
__func__, status);
}
| 0 |
[
"CWE-284",
"CWE-264"
] |
linux
|
1ee0a224bc9aad1de496c795f96bc6ba2c394811
| 14,661,386,442,898,411,000,000,000,000,000,000,000 | 17 |
USB: io_ti: Fix NULL dereference in chase_port()
The tty is NULL when the port is hanging up.
chase_port() needs to check for this.
This patch is intended for stable series.
The behavior was observed and tested in Linux 3.2 and 3.7.1.
Johan Hovold submitted a more elaborate patch for the mainline kernel.
[ 56.277883] usb 1-1: edge_bulk_in_callback - nonzero read bulk status received: -84
[ 56.278811] usb 1-1: USB disconnect, device number 3
[ 56.278856] usb 1-1: edge_bulk_in_callback - stopping read!
[ 56.279562] BUG: unable to handle kernel NULL pointer dereference at 00000000000001c8
[ 56.280536] IP: [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[ 56.281212] PGD 1dc1b067 PUD 1e0f7067 PMD 0
[ 56.282085] Oops: 0002 [#1] SMP
[ 56.282744] Modules linked in:
[ 56.283512] CPU 1
[ 56.283512] Pid: 25, comm: khubd Not tainted 3.7.1 #1 innotek GmbH VirtualBox/VirtualBox
[ 56.283512] RIP: 0010:[<ffffffff8144e62a>] [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[ 56.283512] RSP: 0018:ffff88001fa99ab0 EFLAGS: 00010046
[ 56.283512] RAX: 0000000000000046 RBX: 00000000000001c8 RCX: 0000000000640064
[ 56.283512] RDX: 0000000000010000 RSI: ffff88001fa99b20 RDI: 00000000000001c8
[ 56.283512] RBP: ffff88001fa99b20 R08: 0000000000000000 R09: 0000000000000000
[ 56.283512] R10: 0000000000000000 R11: ffffffff812fcb4c R12: ffff88001ddf53c0
[ 56.283512] R13: 0000000000000000 R14: 00000000000001c8 R15: ffff88001e19b9f4
[ 56.283512] FS: 0000000000000000(0000) GS:ffff88001fd00000(0000) knlGS:0000000000000000
[ 56.283512] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 56.283512] CR2: 00000000000001c8 CR3: 000000001dc51000 CR4: 00000000000006e0
[ 56.283512] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 56.283512] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 56.283512] Process khubd (pid: 25, threadinfo ffff88001fa98000, task ffff88001fa94f80)
[ 56.283512] Stack:
[ 56.283512] 0000000000000046 00000000000001c8 ffffffff810578ec ffffffff812fcb4c
[ 56.283512] ffff88001e19b980 0000000000002710 ffffffff812ffe81 0000000000000001
[ 56.283512] ffff88001fa94f80 0000000000000202 ffffffff00000001 0000000000000296
[ 56.283512] Call Trace:
[ 56.283512] [<ffffffff810578ec>] ? add_wait_queue+0x12/0x3c
[ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
[ 56.283512] [<ffffffff812ffe81>] ? chase_port+0x84/0x2d6
[ 56.283512] [<ffffffff81063f27>] ? try_to_wake_up+0x199/0x199
[ 56.283512] [<ffffffff81263a5c>] ? tty_ldisc_hangup+0x222/0x298
[ 56.283512] [<ffffffff81300171>] ? edge_close+0x64/0x129
[ 56.283512] [<ffffffff810612f7>] ? __wake_up+0x35/0x46
[ 56.283512] [<ffffffff8106135b>] ? should_resched+0x5/0x23
[ 56.283512] [<ffffffff81264916>] ? tty_port_shutdown+0x39/0x44
[ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
[ 56.283512] [<ffffffff8125d38c>] ? __tty_hangup+0x307/0x351
[ 56.283512] [<ffffffff812e6ddc>] ? usb_hcd_flush_endpoint+0xde/0xed
[ 56.283512] [<ffffffff8144e625>] ? _raw_spin_lock_irqsave+0x14/0x35
[ 56.283512] [<ffffffff812fd361>] ? usb_serial_disconnect+0x57/0xc2
[ 56.283512] [<ffffffff812ea99b>] ? usb_unbind_interface+0x5c/0x131
[ 56.283512] [<ffffffff8128d738>] ? __device_release_driver+0x7f/0xd5
[ 56.283512] [<ffffffff8128d9cd>] ? device_release_driver+0x1a/0x25
[ 56.283512] [<ffffffff8128d393>] ? bus_remove_device+0xd2/0xe7
[ 56.283512] [<ffffffff8128b7a3>] ? device_del+0x119/0x167
[ 56.283512] [<ffffffff812e8d9d>] ? usb_disable_device+0x6a/0x180
[ 56.283512] [<ffffffff812e2ae0>] ? usb_disconnect+0x81/0xe6
[ 56.283512] [<ffffffff812e4435>] ? hub_thread+0x577/0xe82
[ 56.283512] [<ffffffff8144daa7>] ? __schedule+0x490/0x4be
[ 56.283512] [<ffffffff8105798f>] ? abort_exclusive_wait+0x79/0x79
[ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
[ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
[ 56.283512] [<ffffffff810570b4>] ? kthread+0x81/0x89
[ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
[ 56.283512] [<ffffffff8145387c>] ? ret_from_fork+0x7c/0xb0
[ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
[ 56.283512] Code: 8b 7c 24 08 e8 17 0b c3 ff 48 8b 04 24 48 83 c4 10 c3 53 48 89 fb 41 50 e8 e0 0a c3 ff 48 89 04 24 e8 e7 0a c3 ff ba 00 00 01 00
<f0> 0f c1 13 48 8b 04 24 89 d1 c1 ea 10 66 39 d1 74 07 f3 90 66
[ 56.283512] RIP [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[ 56.283512] RSP <ffff88001fa99ab0>
[ 56.283512] CR2: 00000000000001c8
[ 56.283512] ---[ end trace 49714df27e1679ce ]---
Signed-off-by: Wolfgang Frisch <[email protected]>
Cc: Johan Hovold <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
static void do_utfreadnewline_invalid(compiler_common *common)
{
/* Slow decoding a UTF-8 character, specialized for newlines.
TMP1 contains the first byte of the character (>= 0xc0). Return
char value in TMP1. */
DEFINE_COMPILER;
struct sljit_label *loop;
struct sljit_label *skip_start;
struct sljit_label *three_byte_exit;
struct sljit_jump *jump[5];
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
if (common->nltype != NLTYPE_ANY)
{
SLJIT_ASSERT(common->nltype != NLTYPE_FIXED || common->newline < 128);
/* All newlines are ascii, just skip intermediate octets. */
jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
loop = LABEL();
if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_POST, TMP2, SLJIT_MEM1(STR_PTR), IN_UCHARS(1)) == SLJIT_SUCCESS)
sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, TMP2, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
else
{
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
}
OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xc0);
CMPTO(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0x80, loop);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
JUMPHERE(jump[0]);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
OP_SRC(SLJIT_FAST_RETURN, RETURN_ADDR, 0);
return;
}
jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
jump[1] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0xc2);
jump[2] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0xe2);
skip_start = LABEL();
OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xc0);
jump[3] = CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0x80);
/* Skip intermediate octets. */
loop = LABEL();
jump[4] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xc0);
CMPTO(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0x80, loop);
JUMPHERE(jump[3]);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
three_byte_exit = LABEL();
JUMPHERE(jump[0]);
JUMPHERE(jump[4]);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
OP_SRC(SLJIT_FAST_RETURN, RETURN_ADDR, 0);
/* Two byte long newline: 0x85. */
JUMPHERE(jump[1]);
CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0x85, skip_start);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0x85);
OP_SRC(SLJIT_FAST_RETURN, RETURN_ADDR, 0);
/* Three byte long newlines: 0x2028 and 0x2029. */
JUMPHERE(jump[2]);
CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0x80, skip_start);
CMPTO(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0, three_byte_exit);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP2(SLJIT_SUB, TMP1, 0, TMP2, 0, SLJIT_IMM, 0x80);
CMPTO(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x40, skip_start);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0x2000);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
OP_SRC(SLJIT_FAST_RETURN, RETURN_ADDR, 0);
}
| 0 |
[
"CWE-125"
] |
pcre2
|
50a51cb7e67268e6ad417eb07c9de9bfea5cc55a
| 38,689,842,391,780,796,000,000,000,000,000,000,000 | 90 |
Fixed a unicode properrty matching issue in JIT
|
GF_Err video_sample_entry_AddBox(GF_Box *s, GF_Box *a)
{
GF_MPEGVisualSampleEntryBox *ptr = (GF_MPEGVisualSampleEntryBox *)s;
switch (a->type) {
case GF_ISOM_BOX_TYPE_ESDS:
if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->esd = (GF_ESDBox *)a;
break;
case GF_ISOM_BOX_TYPE_SINF:
gf_list_add(ptr->protections, a);
break;
case GF_ISOM_BOX_TYPE_RINF:
if (ptr->rinf) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->rinf = (GF_RestrictedSchemeInfoBox *) a;
break;
case GF_ISOM_BOX_TYPE_AVCC:
if (ptr->avc_config) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->avc_config = (GF_AVCConfigurationBox *)a;
break;
case GF_ISOM_BOX_TYPE_HVCC:
if (ptr->hevc_config) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->hevc_config = (GF_HEVCConfigurationBox *)a;
break;
case GF_ISOM_BOX_TYPE_SVCC:
if (ptr->svc_config) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->svc_config = (GF_AVCConfigurationBox *)a;
break;
case GF_ISOM_BOX_TYPE_MVCC:
if (ptr->mvc_config) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->mvc_config = (GF_AVCConfigurationBox *)a;
break;
case GF_ISOM_BOX_TYPE_LHVC:
if (ptr->lhvc_config) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->lhvc_config = (GF_HEVCConfigurationBox *)a;
break;
case GF_ISOM_BOX_TYPE_M4DS:
if (ptr->descr) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->descr = (GF_MPEG4ExtensionDescriptorsBox *)a;
break;
case GF_ISOM_BOX_TYPE_UUID:
if (! memcmp(((GF_UnknownUUIDBox*)a)->uuid, GF_ISOM_IPOD_EXT, 16)) {
if (ptr->ipod_ext) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->ipod_ext = (GF_UnknownUUIDBox *)a;
} else {
return gf_isom_box_add_default(s, a);
}
break;
case GF_ISOM_BOX_TYPE_D263:
ptr->cfg_3gpp = (GF_3GPPConfigBox *)a;
/*for 3GP config, remember sample entry type in config*/
ptr->cfg_3gpp->cfg.type = ptr->type;
break;
break;
case GF_ISOM_BOX_TYPE_PASP:
if (ptr->pasp) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->pasp = (GF_PixelAspectRatioBox *)a;
break;
case GF_ISOM_BOX_TYPE_CLAP:
if (ptr->clap) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->clap = (GF_CleanAppertureBox *)a;
break;
case GF_ISOM_BOX_TYPE_RVCC:
if (ptr->rvcc) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->rvcc = (GF_RVCConfigurationBox *)a;
break;
default:
return gf_isom_box_add_default(s, a);
}
return GF_OK;
}
| 0 |
[
"CWE-125"
] |
gpac
|
bceb03fd2be95097a7b409ea59914f332fb6bc86
| 140,465,076,893,682,760,000,000,000,000,000,000,000 | 71 |
fixed 2 possible heap overflows (inc. #1088)
|
const Router::MetadataMatchCriteria* Filter::metadataMatchCriteria() {
const Router::MetadataMatchCriteria* route_criteria =
(route_ != nullptr) ? route_->metadataMatchCriteria() : nullptr;
const auto& request_metadata = getStreamInfo().dynamicMetadata().filter_metadata();
const auto filter_it = request_metadata.find(Envoy::Config::MetadataFilters::get().ENVOY_LB);
if (filter_it != request_metadata.end() && route_criteria != nullptr) {
metadata_match_criteria_ = route_criteria->mergeMatchCriteria(filter_it->second);
return metadata_match_criteria_.get();
} else if (filter_it != request_metadata.end()) {
metadata_match_criteria_ =
std::make_unique<Router::MetadataMatchCriteriaImpl>(filter_it->second);
return metadata_match_criteria_.get();
} else {
return route_criteria;
}
}
| 0 |
[
"CWE-416"
] |
envoy
|
ce0ae309057a216aba031aff81c445c90c6ef145
| 39,427,309,320,619,330,000,000,000,000,000,000,000 | 18 |
CVE-2021-43826
Signed-off-by: Yan Avlasov <[email protected]>
|
void *hashtable_get(hashtable_t *hashtable, const char *key)
{
pair_t *pair;
size_t hash;
bucket_t *bucket;
hash = hash_str(key);
bucket = &hashtable->buckets[hash & hashmask(hashtable->order)];
pair = hashtable_find_pair(hashtable, bucket, key, hash);
if(!pair)
return NULL;
return pair->value;
}
| 0 |
[
"CWE-310"
] |
jansson
|
8f80c2d83808150724d31793e6ade92749b1faa4
| 220,259,436,363,173,380,000,000,000,000,000,000,000 | 15 |
CVE-2013-6401: Change hash function, randomize hashes
Thanks to Florian Weimer and Eric Sesterhenn for reporting, reviewing
and testing.
|
static int ath6kl_wmi_neighbor_report_event_rx(struct wmi *wmi, u8 *datap,
int len, struct ath6kl_vif *vif)
{
struct wmi_neighbor_report_event *ev;
u8 i;
if (len < sizeof(*ev))
return -EINVAL;
ev = (struct wmi_neighbor_report_event *) datap;
if (struct_size(ev, neighbor, ev->num_neighbors) > len) {
ath6kl_dbg(ATH6KL_DBG_WMI,
"truncated neighbor event (num=%d len=%d)\n",
ev->num_neighbors, len);
return -EINVAL;
}
for (i = 0; i < ev->num_neighbors; i++) {
ath6kl_dbg(ATH6KL_DBG_WMI, "neighbor %d/%d - %pM 0x%x\n",
i + 1, ev->num_neighbors, ev->neighbor[i].bssid,
ev->neighbor[i].bss_flags);
cfg80211_pmksa_candidate_notify(vif->ndev, i,
ev->neighbor[i].bssid,
!!(ev->neighbor[i].bss_flags &
WMI_PREAUTH_CAPABLE_BSS),
GFP_ATOMIC);
}
return 0;
}
| 0 |
[
"CWE-125"
] |
linux
|
5d6751eaff672ea77642e74e92e6c0ac7f9709ab
| 38,879,740,837,309,036,000,000,000,000,000,000,000 | 28 |
ath6kl: add some bounds checking
The "ev->traffic_class" and "reply->ac" variables come from the network
and they're used as an offset into the wmi->stream_exist_for_ac[] array.
Those variables are u8 so they can be 0-255 but the stream_exist_for_ac[]
array only has WMM_NUM_AC (4) elements. We need to add a couple bounds
checks to prevent array overflows.
I also modified one existing check from "if (traffic_class > 3) {" to
"if (traffic_class >= WMM_NUM_AC) {" just to make them all consistent.
Fixes: bdcd81707973 (" Add ath6kl cleaned up driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
|
static Image *ReadPICTImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
#define ThrowPICTException(exception,message) \
{ \
if (tile_image != (Image *) NULL) \
tile_image=DestroyImage(tile_image); \
if (read_info != (ImageInfo *) NULL) \
read_info=DestroyImageInfo(read_info); \
ThrowReaderException((exception),(message)); \
}
char
geometry[MagickPathExtent],
header_ole[4];
Image
*image,
*tile_image;
ImageInfo
*read_info;
int
c,
code;
MagickBooleanType
jpeg,
status;
PICTRectangle
frame;
PICTPixmap
pixmap;
Quantum
index;
register Quantum
*q;
register ssize_t
i,
x;
size_t
extent,
length;
ssize_t
count,
flags,
j,
version,
y;
StringInfo
*profile;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Read PICT header.
*/
read_info=(ImageInfo *) NULL;
tile_image=(Image *) NULL;
pixmap.bits_per_pixel=0;
pixmap.component_count=0;
/*
Skip header : 512 for standard PICT and 4, ie "PICT" for OLE2.
*/
header_ole[0]=ReadBlobByte(image);
header_ole[1]=ReadBlobByte(image);
header_ole[2]=ReadBlobByte(image);
header_ole[3]=ReadBlobByte(image);
if (!((header_ole[0] == 0x50) && (header_ole[1] == 0x49) &&
(header_ole[2] == 0x43) && (header_ole[3] == 0x54 )))
for (i=0; i < 508; i++)
if (ReadBlobByte(image) == EOF)
break;
(void) ReadBlobMSBShort(image); /* skip picture size */
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
while ((c=ReadBlobByte(image)) == 0) ;
if (c != 0x11)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
version=(ssize_t) ReadBlobByte(image);
if (version == 2)
{
c=ReadBlobByte(image);
if (c != 0xff)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
}
else
if (version != 1)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
if ((frame.left < 0) || (frame.right < 0) || (frame.top < 0) ||
(frame.bottom < 0) || (frame.left >= frame.right) ||
(frame.top >= frame.bottom))
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
/*
Create black canvas.
*/
flags=0;
image->depth=8;
image->columns=(size_t) (frame.right-frame.left);
image->rows=(size_t) (frame.bottom-frame.top);
image->resolution.x=DefaultResolution;
image->resolution.y=DefaultResolution;
image->units=UndefinedResolution;
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status != MagickFalse)
status=ResetImagePixels(image,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
/*
Interpret PICT opcodes.
*/
jpeg=MagickFalse;
for (code=0; EOFBlob(image) == MagickFalse; )
{
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
if ((version == 1) || ((TellBlob(image) % 2) != 0))
code=ReadBlobByte(image);
if (version == 2)
code=ReadBlobMSBSignedShort(image);
if (code < 0)
break;
if (code == 0)
continue;
if (code > 0xa1)
{
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"%04X:",code);
}
else
{
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" %04X %s: %s",code,codes[code].name,codes[code].description);
switch (code)
{
case 0x01:
{
/*
Clipping rectangle.
*/
length=ReadBlobMSBShort(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
if (length != 0x000a)
{
for (i=0; i < (ssize_t) (length-2); i++)
if (ReadBlobByte(image) == EOF)
break;
break;
}
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
if (((frame.left & 0x8000) != 0) || ((frame.top & 0x8000) != 0))
break;
image->columns=(size_t) (frame.right-frame.left);
image->rows=(size_t) (frame.bottom-frame.top);
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status != MagickFalse)
status=ResetImagePixels(image,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
break;
}
case 0x12:
case 0x13:
case 0x14:
{
ssize_t
pattern;
size_t
height,
width;
/*
Skip pattern definition.
*/
pattern=(ssize_t) ReadBlobMSBShort(image);
for (i=0; i < 8; i++)
if (ReadBlobByte(image) == EOF)
break;
if (pattern == 2)
{
for (i=0; i < 5; i++)
if (ReadBlobByte(image) == EOF)
break;
break;
}
if (pattern != 1)
ThrowPICTException(CorruptImageError,"UnknownPatternType");
length=ReadBlobMSBShort(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
if (ReadPixmap(image,&pixmap) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
image->depth=(size_t) pixmap.component_size;
image->resolution.x=1.0*pixmap.horizontal_resolution;
image->resolution.y=1.0*pixmap.vertical_resolution;
image->units=PixelsPerInchResolution;
(void) ReadBlobMSBLong(image);
flags=(ssize_t) ReadBlobMSBShort(image);
length=ReadBlobMSBShort(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
for (i=0; i <= (ssize_t) length; i++)
(void) ReadBlobMSBLong(image);
width=(size_t) (frame.bottom-frame.top);
height=(size_t) (frame.right-frame.left);
if (pixmap.bits_per_pixel <= 8)
length&=0x7fff;
if (pixmap.bits_per_pixel == 16)
width<<=1;
if (length == 0)
length=width;
if (length < 8)
{
for (i=0; i < (ssize_t) (length*height); i++)
if (ReadBlobByte(image) == EOF)
break;
}
else
for (i=0; i < (ssize_t) height; i++)
{
if (EOFBlob(image) != MagickFalse)
break;
if (length > 200)
{
for (j=0; j < (ssize_t) ReadBlobMSBShort(image); j++)
if (ReadBlobByte(image) == EOF)
break;
}
else
for (j=0; j < (ssize_t) ReadBlobByte(image); j++)
if (ReadBlobByte(image) == EOF)
break;
}
break;
}
case 0x1b:
{
/*
Initialize image background color.
*/
image->background_color.red=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
image->background_color.green=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
image->background_color.blue=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
break;
}
case 0x70:
case 0x71:
case 0x72:
case 0x73:
case 0x74:
case 0x75:
case 0x76:
case 0x77:
{
/*
Skip polygon or region.
*/
length=ReadBlobMSBShort(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
for (i=0; i < (ssize_t) (length-2); i++)
if (ReadBlobByte(image) == EOF)
break;
break;
}
case 0x90:
case 0x91:
case 0x98:
case 0x99:
case 0x9a:
case 0x9b:
{
PICTRectangle
source,
destination;
register unsigned char
*p;
size_t
j;
ssize_t
bytes_per_line;
unsigned char
*pixels;
/*
Pixmap clipped by a rectangle.
*/
bytes_per_line=0;
if ((code != 0x9a) && (code != 0x9b))
bytes_per_line=(ssize_t) ReadBlobMSBShort(image);
else
{
(void) ReadBlobMSBShort(image);
(void) ReadBlobMSBShort(image);
(void) ReadBlobMSBShort(image);
}
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
/*
Initialize tile image.
*/
tile_image=CloneImage(image,(size_t) (frame.right-frame.left),
(size_t) (frame.bottom-frame.top),MagickTrue,exception);
if (tile_image == (Image *) NULL)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
if ((code == 0x9a) || (code == 0x9b) ||
((bytes_per_line & 0x8000) != 0))
{
if (ReadPixmap(image,&pixmap) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
tile_image->depth=(size_t) pixmap.component_size;
tile_image->alpha_trait=pixmap.component_count == 4 ?
BlendPixelTrait : UndefinedPixelTrait;
tile_image->resolution.x=(double) pixmap.horizontal_resolution;
tile_image->resolution.y=(double) pixmap.vertical_resolution;
tile_image->units=PixelsPerInchResolution;
if (tile_image->alpha_trait != UndefinedPixelTrait)
(void) SetImageAlpha(tile_image,OpaqueAlpha,exception);
}
if ((code != 0x9a) && (code != 0x9b))
{
/*
Initialize colormap.
*/
tile_image->colors=2;
if ((bytes_per_line & 0x8000) != 0)
{
(void) ReadBlobMSBLong(image);
flags=(ssize_t) ReadBlobMSBShort(image);
tile_image->colors=1UL*ReadBlobMSBShort(image)+1;
}
status=AcquireImageColormap(tile_image,tile_image->colors,
exception);
if (status == MagickFalse)
ThrowPICTException(ResourceLimitError,
"MemoryAllocationFailed");
if ((bytes_per_line & 0x8000) != 0)
{
for (i=0; i < (ssize_t) tile_image->colors; i++)
{
j=ReadBlobMSBShort(image) % tile_image->colors;
if ((flags & 0x8000) != 0)
j=(size_t) i;
tile_image->colormap[j].red=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
tile_image->colormap[j].green=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
tile_image->colormap[j].blue=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
}
}
else
{
for (i=0; i < (ssize_t) tile_image->colors; i++)
{
tile_image->colormap[i].red=(Quantum) (QuantumRange-
tile_image->colormap[i].red);
tile_image->colormap[i].green=(Quantum) (QuantumRange-
tile_image->colormap[i].green);
tile_image->colormap[i].blue=(Quantum) (QuantumRange-
tile_image->colormap[i].blue);
}
}
}
if (EOFBlob(image) != MagickFalse)
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
if (ReadRectangle(image,&source) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
if (ReadRectangle(image,&destination) == MagickFalse)
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
(void) ReadBlobMSBShort(image);
if ((code == 0x91) || (code == 0x99) || (code == 0x9b))
{
/*
Skip region.
*/
length=ReadBlobMSBShort(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
for (i=0; i < (ssize_t) (length-2); i++)
if (ReadBlobByte(image) == EOF)
break;
}
if ((code != 0x9a) && (code != 0x9b) &&
(bytes_per_line & 0x8000) == 0)
pixels=DecodeImage(image,tile_image,(size_t) bytes_per_line,1,
&extent);
else
pixels=DecodeImage(image,tile_image,(size_t) bytes_per_line,
(unsigned int) pixmap.bits_per_pixel,&extent);
if (pixels == (unsigned char *) NULL)
ThrowPICTException(CorruptImageError,"UnableToUncompressImage");
/*
Convert PICT tile image to pixel packets.
*/
p=pixels;
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
if (p > (pixels+extent+image->columns))
{
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
ThrowPICTException(CorruptImageError,"NotEnoughPixelData");
}
q=QueueAuthenticPixels(tile_image,0,y,tile_image->columns,1,
exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
if (tile_image->storage_class == PseudoClass)
{
index=(Quantum) ConstrainColormapIndex(tile_image,(ssize_t)
*p,exception);
SetPixelIndex(tile_image,index,q);
SetPixelRed(tile_image,
tile_image->colormap[(ssize_t) index].red,q);
SetPixelGreen(tile_image,
tile_image->colormap[(ssize_t) index].green,q);
SetPixelBlue(tile_image,
tile_image->colormap[(ssize_t) index].blue,q);
}
else
{
if (pixmap.bits_per_pixel == 16)
{
i=(ssize_t) (*p++);
j=(size_t) (*p);
SetPixelRed(tile_image,ScaleCharToQuantum(
(unsigned char) ((i & 0x7c) << 1)),q);
SetPixelGreen(tile_image,ScaleCharToQuantum(
(unsigned char) (((i & 0x03) << 6) |
((j & 0xe0) >> 2))),q);
SetPixelBlue(tile_image,ScaleCharToQuantum(
(unsigned char) ((j & 0x1f) << 3)),q);
}
else
if (tile_image->alpha_trait == UndefinedPixelTrait)
{
if (p > (pixels+extent+2*image->columns))
ThrowPICTException(CorruptImageError,
"NotEnoughPixelData");
SetPixelRed(tile_image,ScaleCharToQuantum(*p),q);
SetPixelGreen(tile_image,ScaleCharToQuantum(
*(p+tile_image->columns)),q);
SetPixelBlue(tile_image,ScaleCharToQuantum(
*(p+2*tile_image->columns)),q);
}
else
{
if (p > (pixels+extent+3*image->columns))
ThrowPICTException(CorruptImageError,
"NotEnoughPixelData");
SetPixelAlpha(tile_image,ScaleCharToQuantum(*p),q);
SetPixelRed(tile_image,ScaleCharToQuantum(
*(p+tile_image->columns)),q);
SetPixelGreen(tile_image,ScaleCharToQuantum(
*(p+2*tile_image->columns)),q);
SetPixelBlue(tile_image,ScaleCharToQuantum(
*(p+3*tile_image->columns)),q);
}
}
p++;
q+=GetPixelChannels(tile_image);
}
if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)
break;
if ((tile_image->storage_class == DirectClass) &&
(pixmap.bits_per_pixel != 16))
{
p+=(pixmap.component_count-1)*tile_image->columns;
if (p < pixels)
break;
}
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
tile_image->rows);
if (status == MagickFalse)
break;
}
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if ((jpeg == MagickFalse) && (EOFBlob(image) == MagickFalse))
if ((code == 0x9a) || (code == 0x9b) ||
((bytes_per_line & 0x8000) != 0))
(void) CompositeImage(image,tile_image,CopyCompositeOp,
MagickTrue,(ssize_t) destination.left,(ssize_t)
destination.top,exception);
tile_image=DestroyImage(tile_image);
break;
}
case 0xa1:
{
unsigned char
*info;
size_t
type;
/*
Comment.
*/
type=ReadBlobMSBShort(image);
length=ReadBlobMSBShort(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
if (length == 0)
break;
(void) ReadBlobMSBLong(image);
length-=MagickMin(length,4);
if (length == 0)
break;
info=(unsigned char *) AcquireQuantumMemory(length,sizeof(*info));
if (info == (unsigned char *) NULL)
break;
count=ReadBlob(image,length,info);
if (count != (ssize_t) length)
{
info=(unsigned char *) RelinquishMagickMemory(info);
ThrowPICTException(ResourceLimitError,"UnableToReadImageData");
}
switch (type)
{
case 0xe0:
{
profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,info);
status=SetImageProfile(image,"icc",profile,exception);
profile=DestroyStringInfo(profile);
if (status == MagickFalse)
{
info=(unsigned char *) RelinquishMagickMemory(info);
ThrowPICTException(ResourceLimitError,
"MemoryAllocationFailed");
}
break;
}
case 0x1f2:
{
profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,info);
status=SetImageProfile(image,"iptc",profile,exception);
if (status == MagickFalse)
{
info=(unsigned char *) RelinquishMagickMemory(info);
ThrowPICTException(ResourceLimitError,
"MemoryAllocationFailed");
}
profile=DestroyStringInfo(profile);
break;
}
default:
break;
}
info=(unsigned char *) RelinquishMagickMemory(info);
break;
}
default:
{
/*
Skip to next op code.
*/
if (codes[code].length == -1)
(void) ReadBlobMSBShort(image);
else
for (i=0; i < (ssize_t) codes[code].length; i++)
if (ReadBlobByte(image) == EOF)
break;
}
}
}
if (code == 0xc00)
{
/*
Skip header.
*/
for (i=0; i < 24; i++)
if (ReadBlobByte(image) == EOF)
break;
continue;
}
if (((code >= 0xb0) && (code <= 0xcf)) ||
((code >= 0x8000) && (code <= 0x80ff)))
continue;
if (code == 0x8200)
{
char
filename[MaxTextExtent];
FILE
*file;
int
unique_file;
/*
Embedded JPEG.
*/
jpeg=MagickTrue;
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
file=(FILE *) NULL;
unique_file=AcquireUniqueFileResource(filename);
(void) FormatLocaleString(read_info->filename,MaxTextExtent,"jpeg:%s",
filename);
if (unique_file != -1)
file=fdopen(unique_file,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
{
(void) RelinquishUniqueFileResource(read_info->filename);
(void) CopyMagickString(image->filename,read_info->filename,
MagickPathExtent);
ThrowPICTException(FileOpenError,"UnableToCreateTemporaryFile");
}
length=ReadBlobMSBLong(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
if (length > 154)
{
for (i=0; i < 6; i++)
(void) ReadBlobMSBLong(image);
if (ReadRectangle(image,&frame) == MagickFalse)
{
(void) fclose(file);
(void) RelinquishUniqueFileResource(read_info->filename);
ThrowPICTException(CorruptImageError,"ImproperImageHeader");
}
for (i=0; i < 122; i++)
if (ReadBlobByte(image) == EOF)
break;
for (i=0; i < (ssize_t) (length-154); i++)
{
c=ReadBlobByte(image);
if (c == EOF)
break;
if (fputc(c,file) != c)
break;
}
}
(void) fclose(file);
(void) close(unique_file);
tile_image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(filename);
read_info=DestroyImageInfo(read_info);
if (tile_image == (Image *) NULL)
continue;
(void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g",
(double) MagickMax(image->columns,tile_image->columns),
(double) MagickMax(image->rows,tile_image->rows));
(void) SetImageExtent(image,
MagickMax(image->columns,tile_image->columns),
MagickMax(image->rows,tile_image->rows),exception);
(void) TransformImageColorspace(image,tile_image->colorspace,exception);
(void) CompositeImage(image,tile_image,CopyCompositeOp,MagickTrue,
(ssize_t) frame.left,(ssize_t) frame.right,exception);
image->compression=tile_image->compression;
tile_image=DestroyImage(tile_image);
continue;
}
if ((code == 0xff) || (code == 0xffff))
break;
if (((code >= 0xd0) && (code <= 0xfe)) ||
((code >= 0x8100) && (code <= 0xffff)))
{
/*
Skip reserved.
*/
length=ReadBlobMSBShort(image);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
for (i=0; i < (ssize_t) length; i++)
if (ReadBlobByte(image) == EOF)
break;
continue;
}
if ((code >= 0x100) && (code <= 0x7fff))
{
/*
Skip reserved.
*/
length=(size_t) ((code >> 7) & 0xff);
if (length > GetBlobSize(image))
ThrowPICTException(CorruptImageError,
"InsufficientImageDataInFile");
for (i=0; i < (ssize_t) length; i++)
if (ReadBlobByte(image) == EOF)
break;
continue;
}
}
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
| 0 |
[
"CWE-20",
"CWE-119",
"CWE-787"
] |
ImageMagick
|
afa878a689870c28b6994ecf3bb8dbfb2b76d135
| 25,945,577,455,323,313,000,000,000,000,000,000,000 | 743 |
https://github.com/ImageMagick/ImageMagick/issues/1269
|
varbit(PG_FUNCTION_ARGS)
{
VarBit *arg = PG_GETARG_VARBIT_P(0);
int32 len = PG_GETARG_INT32(1);
bool isExplicit = PG_GETARG_BOOL(2);
VarBit *result;
int rlen;
int ipad;
bits8 mask;
/* No work if typmod is invalid or supplied data matches it already */
if (len <= 0 || len >= VARBITLEN(arg))
PG_RETURN_VARBIT_P(arg);
if (!isExplicit)
ereport(ERROR,
(errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
errmsg("bit string too long for type bit varying(%d)",
len)));
rlen = VARBITTOTALLEN(len);
result = (VarBit *) palloc(rlen);
SET_VARSIZE(result, rlen);
VARBITLEN(result) = len;
memcpy(VARBITS(result), VARBITS(arg), VARBITBYTES(result));
/* Make sure last byte is zero-padded if needed */
ipad = VARBITPAD(result);
if (ipad > 0)
{
mask = BITMASK << ipad;
*(VARBITS(result) + VARBITBYTES(result) - 1) &= mask;
}
PG_RETURN_VARBIT_P(result);
}
| 0 |
[
"CWE-703",
"CWE-189"
] |
postgres
|
31400a673325147e1205326008e32135a78b4d8a
| 240,210,251,284,357,750,000,000,000,000,000,000,000 | 37 |
Predict integer overflow to avoid buffer overruns.
Several functions, mostly type input functions, calculated an allocation
size such that the calculation wrapped to a small positive value when
arguments implied a sufficiently-large requirement. Writes past the end
of the inadvertent small allocation followed shortly thereafter.
Coverity identified the path_in() vulnerability; code inspection led to
the rest. In passing, add check_stack_depth() to prevent stack overflow
in related functions.
Back-patch to 8.4 (all supported versions). The non-comment hstore
changes touch code that did not exist in 8.4, so that part stops at 9.0.
Noah Misch and Heikki Linnakangas, reviewed by Tom Lane.
Security: CVE-2014-0064
|
int X509_cmp_current_time(const ASN1_TIME *ctm)
{
return X509_cmp_time(ctm, NULL);
}
| 0 |
[] |
openssl
|
d65b8b2162f33ac0d53dace588a0847ed827626c
| 112,263,603,901,882,720,000,000,000,000,000,000,000 | 4 |
Backport OCSP fixes.
|
int RGWSetBucketWebsite::verify_permission()
{
return verify_bucket_owner_or_policy(s, rgw::IAM::s3PutBucketWebsite);
}
| 0 |
[
"CWE-770"
] |
ceph
|
ab29bed2fc9f961fe895de1086a8208e21ddaddc
| 54,926,980,242,588,240,000,000,000,000,000,000,000 | 4 |
rgw: fix issues with 'enforce bounds' patch
The patch to enforce bounds on max-keys/max-uploads/max-parts had a few
issues that would prevent us from compiling it. Instead of changing the
code provided by the submitter, we're addressing them in a separate
commit to maintain the DCO.
Signed-off-by: Joao Eduardo Luis <[email protected]>
Signed-off-by: Abhishek Lekshmanan <[email protected]>
(cherry picked from commit 29bc434a6a81a2e5c5b8cfc4c8d5c82ca5bf538a)
mimic specific fixes:
As the largeish change from master g_conf() isn't in mimic yet, use the g_conf
global structure, also make rgw_op use the value from req_info ceph context as
we do for all the requests
|
parse_channel_cipher_suite_data(uint8_t *cipher_suite_data, size_t data_len,
struct cipher_suite_info* suites,
size_t nr_suites)
{
size_t count = 0;
size_t offset = 0;
/* Default everything to zeroes */
memset(suites, 0, sizeof(*suites) * nr_suites);
while (offset < data_len && count < nr_suites) {
size_t suite_size;
/* Set non-zero defaults */
suites[count].auth_alg = IPMI_AUTH_RAKP_NONE;
suites[count].integrity_alg = IPMI_INTEGRITY_NONE;
suites[count].crypt_alg = IPMI_CRYPT_NONE;
/* Update fields from cipher suite data */
suite_size = parse_cipher_suite(cipher_suite_data + offset,
data_len - offset,
&suites[count].iana,
&suites[count].auth_alg,
&suites[count].integrity_alg,
&suites[count].crypt_alg,
&suites[count].cipher_suite_id);
if (!suite_size) {
lprintf(LOG_INFO,
"Failed to parse cipher suite data at offset %d",
offset);
break;
}
offset += suite_size;
count++;
}
return count;
}
| 0 |
[
"CWE-120"
] |
ipmitool
|
9452be87181a6e83cfcc768b3ed8321763db50e4
| 227,241,832,873,001,200,000,000,000,000,000,000,000 | 39 |
channel: Fix buffer overflow
Partial fix for CVE-2020-5208, see
https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp
The `ipmi_get_channel_cipher_suites` function does not properly check
the final response’s `data_len`, which can lead to stack buffer overflow
on the final copy.
|
TEST_F(RenameCollectionTest, RenameCollectionToItselfByUUIDForApplyOps) {
auto dbName = _targetNss.db().toString();
auto uuid = _createCollectionWithUUID(_opCtx.get(), _targetNss);
auto uuidDoc = BSON("ui" << uuid);
auto cmd = BSON("renameCollection" << _sourceNss.ns() << "to" << _targetNss.ns() << "dropTarget"
<< true);
ASSERT_OK(renameCollectionForApplyOps(_opCtx.get(), dbName, uuidDoc["ui"], cmd, {}));
ASSERT_TRUE(_collectionExists(_opCtx.get(), _targetNss));
}
| 0 |
[
"CWE-20"
] |
mongo
|
35c1b1f588f04926a958ad2fe4d9c59d79f81e8b
| 221,725,284,509,234,800,000,000,000,000,000,000,000 | 9 |
SERVER-35636 renameCollectionForApplyOps checks for complete namespace
|
explicit AssignVariableOp(OpKernelConstruction* c) : OpKernel(c) {
OP_REQUIRES_OK(c, c->GetAttr("dtype", &dtype_));
if (!c->GetAttr("_grappler_relax_allocator_constraints",
&relax_constraints_)
.ok()) {
relax_constraints_ = false;
}
}
| 0 |
[
"CWE-369"
] |
tensorflow
|
ac117ee8a8ea57b73d34665cdf00ef3303bc0b11
| 49,423,704,111,448,450,000,000,000,000,000,000,000 | 8 |
Prevent division by 0 in `resource_variable_ops.cc`
PiperOrigin-RevId: 387939939
Change-Id: Ib04902d63756633999959a70613f2eaa30c2c151
|
R_API int r_str_fmtargs(const char *fmt) {
int n = 0;
while (*fmt) {
if (*fmt == '%') {
if (fmt[1] == '*') {
n++;
}
n++;
}
fmt++;
}
return n;
}
| 0 |
[
"CWE-78"
] |
radare2
|
04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9
| 175,519,833,997,243,100,000,000,000,000,000,000,000 | 13 |
Fix command injection on PDB download (#16966)
* Fix r_sys_mkdirp with absolute path on Windows
* Fix build with --with-openssl
* Use RBuffer in r_socket_http_answer()
* r_socket_http_answer: Fix read for big responses
* Implement r_str_escape_sh()
* Cleanup r_socket_connect() on Windows
* Fix socket being created without a protocol
* Fix socket connect with SSL ##socket
* Use select() in r_socket_ready()
* Fix read failing if received only protocol answer
* Fix double-free
* r_socket_http_get: Fail if req. SSL with no support
* Follow redirects in r_socket_http_answer()
* Fix r_socket_http_get result length with R2_CURL=1
* Also follow redirects
* Avoid using curl for downloading PDBs
* Use r_socket_http_get() on UNIXs
* Use WinINet API on Windows for r_socket_http_get()
* Fix command injection
* Fix r_sys_cmd_str_full output for binary data
* Validate GUID on PDB download
* Pass depth to socket_http_get_recursive()
* Remove 'r_' and '__' from static function names
* Fix is_valid_guid
* Fix for comments
|
int security_node_sid(u16 domain,
void *addrp,
u32 addrlen,
u32 *out_sid)
{
int rc;
struct ocontext *c;
read_lock(&policy_rwlock);
switch (domain) {
case AF_INET: {
u32 addr;
rc = -EINVAL;
if (addrlen != sizeof(u32))
goto out;
addr = *((u32 *)addrp);
c = policydb.ocontexts[OCON_NODE];
while (c) {
if (c->u.node.addr == (addr & c->u.node.mask))
break;
c = c->next;
}
break;
}
case AF_INET6:
rc = -EINVAL;
if (addrlen != sizeof(u64) * 2)
goto out;
c = policydb.ocontexts[OCON_NODE6];
while (c) {
if (match_ipv6_addrmask(addrp, c->u.node6.addr,
c->u.node6.mask))
break;
c = c->next;
}
break;
default:
rc = 0;
*out_sid = SECINITSID_NODE;
goto out;
}
if (c) {
if (!c->sid[0]) {
rc = sidtab_context_to_sid(&sidtab,
&c->context[0],
&c->sid[0]);
if (rc)
goto out;
}
*out_sid = c->sid[0];
} else {
*out_sid = SECINITSID_NODE;
}
rc = 0;
out:
read_unlock(&policy_rwlock);
return rc;
}
| 0 |
[
"CWE-20"
] |
linux
|
2172fa709ab32ca60e86179dc67d0857be8e2c98
| 117,191,182,882,899,980,000,000,000,000,000,000,000 | 66 |
SELinux: Fix kernel BUG on empty security contexts.
Setting an empty security context (length=0) on a file will
lead to incorrectly dereferencing the type and other fields
of the security context structure, yielding a kernel BUG.
As a zero-length security context is never valid, just reject
all such security contexts whether coming from userspace
via setxattr or coming from the filesystem upon a getxattr
request by SELinux.
Setting a security context value (empty or otherwise) unknown to
SELinux in the first place is only possible for a root process
(CAP_MAC_ADMIN), and, if running SELinux in enforcing mode, only
if the corresponding SELinux mac_admin permission is also granted
to the domain by policy. In Fedora policies, this is only allowed for
specific domains such as livecd for setting down security contexts
that are not defined in the build host policy.
Reproducer:
su
setenforce 0
touch foo
setfattr -n security.selinux foo
Caveat:
Relabeling or removing foo after doing the above may not be possible
without booting with SELinux disabled. Any subsequent access to foo
after doing the above will also trigger the BUG.
BUG output from Matthew Thode:
[ 473.893141] ------------[ cut here ]------------
[ 473.962110] kernel BUG at security/selinux/ss/services.c:654!
[ 473.995314] invalid opcode: 0000 [#6] SMP
[ 474.027196] Modules linked in:
[ 474.058118] CPU: 0 PID: 8138 Comm: ls Tainted: G D I
3.13.0-grsec #1
[ 474.116637] Hardware name: Supermicro X8ST3/X8ST3, BIOS 2.0
07/29/10
[ 474.149768] task: ffff8805f50cd010 ti: ffff8805f50cd488 task.ti:
ffff8805f50cd488
[ 474.183707] RIP: 0010:[<ffffffff814681c7>] [<ffffffff814681c7>]
context_struct_compute_av+0xce/0x308
[ 474.219954] RSP: 0018:ffff8805c0ac3c38 EFLAGS: 00010246
[ 474.252253] RAX: 0000000000000000 RBX: ffff8805c0ac3d94 RCX:
0000000000000100
[ 474.287018] RDX: ffff8805e8aac000 RSI: 00000000ffffffff RDI:
ffff8805e8aaa000
[ 474.321199] RBP: ffff8805c0ac3cb8 R08: 0000000000000010 R09:
0000000000000006
[ 474.357446] R10: 0000000000000000 R11: ffff8805c567a000 R12:
0000000000000006
[ 474.419191] R13: ffff8805c2b74e88 R14: 00000000000001da R15:
0000000000000000
[ 474.453816] FS: 00007f2e75220800(0000) GS:ffff88061fc00000(0000)
knlGS:0000000000000000
[ 474.489254] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 474.522215] CR2: 00007f2e74716090 CR3: 00000005c085e000 CR4:
00000000000207f0
[ 474.556058] Stack:
[ 474.584325] ffff8805c0ac3c98 ffffffff811b549b ffff8805c0ac3c98
ffff8805f1190a40
[ 474.618913] ffff8805a6202f08 ffff8805c2b74e88 00068800d0464990
ffff8805e8aac860
[ 474.653955] ffff8805c0ac3cb8 000700068113833a ffff880606c75060
ffff8805c0ac3d94
[ 474.690461] Call Trace:
[ 474.723779] [<ffffffff811b549b>] ? lookup_fast+0x1cd/0x22a
[ 474.778049] [<ffffffff81468824>] security_compute_av+0xf4/0x20b
[ 474.811398] [<ffffffff8196f419>] avc_compute_av+0x2a/0x179
[ 474.843813] [<ffffffff8145727b>] avc_has_perm+0x45/0xf4
[ 474.875694] [<ffffffff81457d0e>] inode_has_perm+0x2a/0x31
[ 474.907370] [<ffffffff81457e76>] selinux_inode_getattr+0x3c/0x3e
[ 474.938726] [<ffffffff81455cf6>] security_inode_getattr+0x1b/0x22
[ 474.970036] [<ffffffff811b057d>] vfs_getattr+0x19/0x2d
[ 475.000618] [<ffffffff811b05e5>] vfs_fstatat+0x54/0x91
[ 475.030402] [<ffffffff811b063b>] vfs_lstat+0x19/0x1b
[ 475.061097] [<ffffffff811b077e>] SyS_newlstat+0x15/0x30
[ 475.094595] [<ffffffff8113c5c1>] ? __audit_syscall_entry+0xa1/0xc3
[ 475.148405] [<ffffffff8197791e>] system_call_fastpath+0x16/0x1b
[ 475.179201] Code: 00 48 85 c0 48 89 45 b8 75 02 0f 0b 48 8b 45 a0 48
8b 3d 45 d0 b6 00 8b 40 08 89 c6 ff ce e8 d1 b0 06 00 48 85 c0 49 89 c7
75 02 <0f> 0b 48 8b 45 b8 4c 8b 28 eb 1e 49 8d 7d 08 be 80 01 00 00 e8
[ 475.255884] RIP [<ffffffff814681c7>]
context_struct_compute_av+0xce/0x308
[ 475.296120] RSP <ffff8805c0ac3c38>
[ 475.328734] ---[ end trace f076482e9d754adc ]---
Reported-by: Matthew Thode <[email protected]>
Signed-off-by: Stephen Smalley <[email protected]>
Cc: [email protected]
Signed-off-by: Paul Moore <[email protected]>
|
static void *io_mem_alloc(size_t size)
{
gfp_t gfp_flags = GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN | __GFP_COMP |
__GFP_NORETRY;
return (void *) __get_free_pages(gfp_flags, get_order(size));
}
| 0 |
[] |
linux
|
181e448d8709e517c9c7b523fcd209f24eb38ca7
| 184,687,629,998,230,630,000,000,000,000,000,000,000 | 7 |
io_uring: async workers should inherit the user creds
If we don't inherit the original task creds, then we can confuse users
like fuse that pass creds in the request header. See link below on
identical aio issue.
Link: https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u
Signed-off-by: Jens Axboe <[email protected]>
|
ModuleSASL()
: authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt)
{
}
| 0 |
[
"CWE-284",
"CWE-264"
] |
inspircd
|
74fafb7f11b06747f69f182ad5e3769b665eea7a
| 195,239,272,098,695,230,000,000,000,000,000,000,000 | 4 |
m_sasl: don't allow AUTHENTICATE with mechanisms with a space
|
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, void *buf, hwaddr len)
{
MemTxResult result = MEMTX_OK;
FlatView *fv;
if (len > 0) {
fv = address_space_to_flatview(as);
result = flatview_read(as->uc, fv, addr, attrs, buf, len);
}
return result;
}
| 0 |
[
"CWE-476"
] |
unicorn
|
3d3deac5e6d38602b689c4fef5dac004f07a2e63
| 199,057,265,524,990,530,000,000,000,000,000,000,000 | 13 |
Fix crash when mapping a big memory and calling uc_close
|
static void __update_reg64_bounds(struct bpf_reg_state *reg)
{
/* min signed is max(sign bit) | min(other bits) */
reg->smin_value = max_t(s64, reg->smin_value,
reg->var_off.value | (reg->var_off.mask & S64_MIN));
/* max signed is min(sign bit) | max(other bits) */
reg->smax_value = min_t(s64, reg->smax_value,
reg->var_off.value | (reg->var_off.mask & S64_MAX));
reg->umin_value = max(reg->umin_value, reg->var_off.value);
reg->umax_value = min(reg->umax_value,
reg->var_off.value | reg->var_off.mask);
}
| 0 |
[
"CWE-119",
"CWE-681",
"CWE-787"
] |
linux
|
5b9fbeb75b6a98955f628e205ac26689bcb1383e
| 337,775,898,937,122,500,000,000,000,000,000,000,000 | 12 |
bpf: Fix scalar32_min_max_or bounds tracking
Simon reported an issue with the current scalar32_min_max_or() implementation.
That is, compared to the other 32 bit subreg tracking functions, the code in
scalar32_min_max_or() stands out that it's using the 64 bit registers instead
of 32 bit ones. This leads to bounds tracking issues, for example:
[...]
8: R0=map_value(id=0,off=0,ks=4,vs=48,imm=0) R10=fp0 fp-8=mmmmmmmm
8: (79) r1 = *(u64 *)(r0 +0)
R0=map_value(id=0,off=0,ks=4,vs=48,imm=0) R10=fp0 fp-8=mmmmmmmm
9: R0=map_value(id=0,off=0,ks=4,vs=48,imm=0) R1_w=inv(id=0) R10=fp0 fp-8=mmmmmmmm
9: (b7) r0 = 1
10: R0_w=inv1 R1_w=inv(id=0) R10=fp0 fp-8=mmmmmmmm
10: (18) r2 = 0x600000002
12: R0_w=inv1 R1_w=inv(id=0) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
12: (ad) if r1 < r2 goto pc+1
R0_w=inv1 R1_w=inv(id=0,umin_value=25769803778) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
13: R0_w=inv1 R1_w=inv(id=0,umin_value=25769803778) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
13: (95) exit
14: R0_w=inv1 R1_w=inv(id=0,umax_value=25769803777,var_off=(0x0; 0x7ffffffff)) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
14: (25) if r1 > 0x0 goto pc+1
R0_w=inv1 R1_w=inv(id=0,umax_value=0,var_off=(0x0; 0x7fffffff),u32_max_value=2147483647) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
15: R0_w=inv1 R1_w=inv(id=0,umax_value=0,var_off=(0x0; 0x7fffffff),u32_max_value=2147483647) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
15: (95) exit
16: R0_w=inv1 R1_w=inv(id=0,umin_value=1,umax_value=25769803777,var_off=(0x0; 0x77fffffff),u32_max_value=2147483647) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
16: (47) r1 |= 0
17: R0_w=inv1 R1_w=inv(id=0,umin_value=1,umax_value=32212254719,var_off=(0x1; 0x700000000),s32_max_value=1,u32_max_value=1) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
[...]
The bound tests on the map value force the upper unsigned bound to be 25769803777
in 64 bit (0b11000000000000000000000000000000001) and then lower one to be 1. By
using OR they are truncated and thus result in the range [1,1] for the 32 bit reg
tracker. This is incorrect given the only thing we know is that the value must be
positive and thus 2147483647 (0b1111111111111111111111111111111) at max for the
subregs. Fix it by using the {u,s}32_{min,max}_value vars instead. This also makes
sense, for example, for the case where we update dst_reg->s32_{min,max}_value in
the else branch we need to use the newly computed dst_reg->u32_{min,max}_value as
we know that these are positive. Previously, in the else branch the 64 bit values
of umin_value=1 and umax_value=32212254719 were used and latter got truncated to
be 1 as upper bound there. After the fix the subreg range is now correct:
[...]
8: R0=map_value(id=0,off=0,ks=4,vs=48,imm=0) R10=fp0 fp-8=mmmmmmmm
8: (79) r1 = *(u64 *)(r0 +0)
R0=map_value(id=0,off=0,ks=4,vs=48,imm=0) R10=fp0 fp-8=mmmmmmmm
9: R0=map_value(id=0,off=0,ks=4,vs=48,imm=0) R1_w=inv(id=0) R10=fp0 fp-8=mmmmmmmm
9: (b7) r0 = 1
10: R0_w=inv1 R1_w=inv(id=0) R10=fp0 fp-8=mmmmmmmm
10: (18) r2 = 0x600000002
12: R0_w=inv1 R1_w=inv(id=0) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
12: (ad) if r1 < r2 goto pc+1
R0_w=inv1 R1_w=inv(id=0,umin_value=25769803778) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
13: R0_w=inv1 R1_w=inv(id=0,umin_value=25769803778) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
13: (95) exit
14: R0_w=inv1 R1_w=inv(id=0,umax_value=25769803777,var_off=(0x0; 0x7ffffffff)) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
14: (25) if r1 > 0x0 goto pc+1
R0_w=inv1 R1_w=inv(id=0,umax_value=0,var_off=(0x0; 0x7fffffff),u32_max_value=2147483647) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
15: R0_w=inv1 R1_w=inv(id=0,umax_value=0,var_off=(0x0; 0x7fffffff),u32_max_value=2147483647) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
15: (95) exit
16: R0_w=inv1 R1_w=inv(id=0,umin_value=1,umax_value=25769803777,var_off=(0x0; 0x77fffffff),u32_max_value=2147483647) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
16: (47) r1 |= 0
17: R0_w=inv1 R1_w=inv(id=0,umin_value=1,umax_value=32212254719,var_off=(0x0; 0x77fffffff),u32_max_value=2147483647) R2_w=inv25769803778 R10=fp0 fp-8=mmmmmmmm
[...]
Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Reported-by: Simon Scannell <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Reviewed-by: John Fastabend <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
|
static void commit_parameter(int snum, struct parm_struct *parm, const char *v)
{
int i;
char *s;
if (snum < 0 && parm->p_class == P_LOCAL) {
/* this handles the case where we are changing a local
variable globally. We need to change the parameter in
all shares where it is currently set to the default */
for (i=0;i<lp_numservices();i++) {
s = lp_servicename(i);
if (s && (*s) && lp_is_default(i, parm)) {
lp_do_parameter(i, parm->label, v);
}
}
}
lp_do_parameter(snum, parm->label, v);
}
| 0 |
[] |
samba
|
71225948a249f079120282740fcc39fd6faa880e
| 130,182,467,800,428,460,000,000,000,000,000,000,000 | 19 |
swat: Use X-Frame-Options header to avoid clickjacking
Jann Horn reported a potential clickjacking vulnerability in SWAT where
the SWAT page could be embedded into an attacker's page using a frame or
iframe and then used to trick the user to change Samba settings.
Avoid this by telling the browser to refuse the frame embedding via the
X-Frame-Options: DENY header.
Signed-off-by: Kai Blin <[email protected]>
Fix bug #9576 - CVE-2013-0213: Clickjacking issue in SWAT.
|
static int udf_do_extend_file(struct inode *inode,
struct extent_position *last_pos,
struct kernel_long_ad *last_ext,
sector_t blocks)
{
sector_t add;
int count = 0, fake = !(last_ext->extLength & UDF_EXTENT_LENGTH_MASK);
struct super_block *sb = inode->i_sb;
struct kernel_lb_addr prealloc_loc = {};
int prealloc_len = 0;
struct udf_inode_info *iinfo;
int err;
/* The previous extent is fake and we should not extend by anything
* - there's nothing to do... */
if (!blocks && fake)
return 0;
iinfo = UDF_I(inode);
/* Round the last extent up to a multiple of block size */
if (last_ext->extLength & (sb->s_blocksize - 1)) {
last_ext->extLength =
(last_ext->extLength & UDF_EXTENT_FLAG_MASK) |
(((last_ext->extLength & UDF_EXTENT_LENGTH_MASK) +
sb->s_blocksize - 1) & ~(sb->s_blocksize - 1));
iinfo->i_lenExtents =
(iinfo->i_lenExtents + sb->s_blocksize - 1) &
~(sb->s_blocksize - 1);
}
/* Last extent are just preallocated blocks? */
if ((last_ext->extLength & UDF_EXTENT_FLAG_MASK) ==
EXT_NOT_RECORDED_ALLOCATED) {
/* Save the extent so that we can reattach it to the end */
prealloc_loc = last_ext->extLocation;
prealloc_len = last_ext->extLength;
/* Mark the extent as a hole */
last_ext->extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |
(last_ext->extLength & UDF_EXTENT_LENGTH_MASK);
last_ext->extLocation.logicalBlockNum = 0;
last_ext->extLocation.partitionReferenceNum = 0;
}
/* Can we merge with the previous extent? */
if ((last_ext->extLength & UDF_EXTENT_FLAG_MASK) ==
EXT_NOT_RECORDED_NOT_ALLOCATED) {
add = ((1 << 30) - sb->s_blocksize -
(last_ext->extLength & UDF_EXTENT_LENGTH_MASK)) >>
sb->s_blocksize_bits;
if (add > blocks)
add = blocks;
blocks -= add;
last_ext->extLength += add << sb->s_blocksize_bits;
}
if (fake) {
udf_add_aext(inode, last_pos, &last_ext->extLocation,
last_ext->extLength, 1);
count++;
} else
udf_write_aext(inode, last_pos, &last_ext->extLocation,
last_ext->extLength, 1);
/* Managed to do everything necessary? */
if (!blocks)
goto out;
/* All further extents will be NOT_RECORDED_NOT_ALLOCATED */
last_ext->extLocation.logicalBlockNum = 0;
last_ext->extLocation.partitionReferenceNum = 0;
add = (1 << (30-sb->s_blocksize_bits)) - 1;
last_ext->extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |
(add << sb->s_blocksize_bits);
/* Create enough extents to cover the whole hole */
while (blocks > add) {
blocks -= add;
err = udf_add_aext(inode, last_pos, &last_ext->extLocation,
last_ext->extLength, 1);
if (err)
return err;
count++;
}
if (blocks) {
last_ext->extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |
(blocks << sb->s_blocksize_bits);
err = udf_add_aext(inode, last_pos, &last_ext->extLocation,
last_ext->extLength, 1);
if (err)
return err;
count++;
}
out:
/* Do we have some preallocated blocks saved? */
if (prealloc_len) {
err = udf_add_aext(inode, last_pos, &prealloc_loc,
prealloc_len, 1);
if (err)
return err;
last_ext->extLocation = prealloc_loc;
last_ext->extLength = prealloc_len;
count++;
}
/* last_pos should point to the last written extent... */
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
last_pos->offset -= sizeof(struct short_ad);
else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG)
last_pos->offset -= sizeof(struct long_ad);
else
return -EIO;
return count;
}
| 0 |
[
"CWE-703",
"CWE-189"
] |
linux
|
23b133bdc452aa441fcb9b82cbf6dd05cfd342d0
| 161,938,642,585,088,800,000,000,000,000,000,000,000 | 115 |
udf: Check length of extended attributes and allocation descriptors
Check length of extended attributes and allocation descriptors when
loading inodes from disk. Otherwise corrupted filesystems could confuse
the code and make the kernel oops.
Reported-by: Carl Henrik Lunde <[email protected]>
CC: [email protected]
Signed-off-by: Jan Kara <[email protected]>
|
httpd_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
isc_httpd_t *httpd = (isc_httpd_t *)arg;
REQUIRE(VALID_HTTPD(httpd));
REQUIRE(httpd->state == SEND);
REQUIRE(httpd->handle == handle);
isc_buffer_free(&httpd->sendbuffer);
/*
* We will always want to clean up our receive buffer, even if we
* got an error on send or we are shutting down.
*/
if (httpd->freecb != NULL) {
isc_buffer_t *b = NULL;
if (isc_buffer_length(&httpd->bodybuffer) > 0) {
b = &httpd->bodybuffer;
httpd->freecb(b, httpd->freecb_arg);
}
}
isc_nmhandle_detach(&httpd->sendhandle);
if (result != ISC_R_SUCCESS) {
goto cleanup_readhandle;
}
if ((httpd->flags & HTTPD_CLOSE) != 0) {
goto cleanup_readhandle;
}
httpd->state = RECV;
httpd->sendhandle = NULL;
if (httpd->recvlen != 0) {
/*
* Outstanding requests still exist, start processing
* them.
*/
httpd_request(httpd->handle, ISC_R_SUCCESS, NULL, httpd->mgr);
} else if (!httpd->truncated) {
isc_nm_resumeread(httpd->readhandle);
} else {
/* Truncated request, don't resume */
goto cleanup_readhandle;
}
return;
cleanup_readhandle:
isc_nmhandle_detach(&httpd->readhandle);
}
| 0 |
[] |
bind9
|
d4c5d1c650ae0e97a083b0ce7a705c20fc001f07
| 284,044,051,125,735,000,000,000,000,000,000,000,000 | 52 |
Fix statistics channel multiple request processing with non-empty bodies
When the HTTP request has a body part after the HTTP headers, it is
not getting processed and is being prepended to the next request's data,
which results in an error when trying to parse it.
Improve the httpd.c:process_request() function with the following
additions:
1. Require that HTTP POST requests must have Content-Length header.
2. When Content-Length header is set, extract its value, and make sure
that it is valid and that the whole request's body is received before
processing the request.
3. Discard the request's body by consuming Content-Length worth of data
in the buffer.
(cherry picked from commit c2bbdc8a648c9630b2c9cea5227ad5c309c2ade5)
|
int pop_open_connection(struct PopAccountData *adata)
{
char buf[1024];
int rc = pop_connect(adata);
if (rc < 0)
return rc;
rc = pop_capabilities(adata, 0);
if (rc == -1)
goto err_conn;
if (rc == -2)
return -2;
#ifdef USE_SSL
/* Attempt STLS if available and desired. */
if (!adata->conn->ssf && (adata->cmd_stls || C_SslForceTls))
{
if (C_SslForceTls)
adata->use_stls = 2;
if (adata->use_stls == 0)
{
enum QuadOption ans =
query_quadoption(C_SslStarttls, _("Secure connection with TLS?"));
if (ans == MUTT_ABORT)
return -2;
adata->use_stls = 1;
if (ans == MUTT_YES)
adata->use_stls = 2;
}
if (adata->use_stls == 2)
{
mutt_str_strfcpy(buf, "STLS\r\n", sizeof(buf));
rc = pop_query(adata, buf, sizeof(buf));
if (rc == -1)
goto err_conn;
if (rc != 0)
{
mutt_error("%s", adata->err_msg);
}
else if (mutt_ssl_starttls(adata->conn))
{
mutt_error(_("Could not negotiate TLS connection"));
return -2;
}
else
{
/* recheck capabilities after STLS completes */
rc = pop_capabilities(adata, 1);
if (rc == -1)
goto err_conn;
if (rc == -2)
return -2;
}
}
}
if (C_SslForceTls && !adata->conn->ssf)
{
mutt_error(_("Encrypted connection unavailable"));
return -2;
}
#endif
rc = pop_authenticate(adata);
if (rc == -1)
goto err_conn;
if (rc == -3)
mutt_clear_error();
if (rc != 0)
return rc;
/* recheck capabilities after authentication */
rc = pop_capabilities(adata, 2);
if (rc == -1)
goto err_conn;
if (rc == -2)
return -2;
/* get total size of mailbox */
mutt_str_strfcpy(buf, "STAT\r\n", sizeof(buf));
rc = pop_query(adata, buf, sizeof(buf));
if (rc == -1)
goto err_conn;
if (rc == -2)
{
mutt_error("%s", adata->err_msg);
return rc;
}
unsigned int n = 0, size = 0;
sscanf(buf, "+OK %u %u", &n, &size);
adata->size = size;
return 0;
err_conn:
adata->status = POP_DISCONNECTED;
mutt_error(_("Server closed connection"));
return -1;
}
| 1 |
[
"CWE-94",
"CWE-74"
] |
neomutt
|
fb013ec666759cb8a9e294347c7b4c1f597639cc
| 300,648,256,177,216,950,000,000,000,000,000,000,000 | 100 |
tls: clear data after a starttls acknowledgement
After a starttls acknowledgement message, clear the buffers of any
incoming data / commands. This will ensure that all future data is
handled securely.
Co-authored-by: Pietro Cerutti <[email protected]>
|
encode_SET_IP_DSCP(const struct ofpact_dscp *dscp,
enum ofp_version ofp_version, struct ofpbuf *out)
{
if (ofp_version < OFP12_VERSION) {
put_OFPAT_SET_NW_TOS(out, ofp_version, dscp->dscp);
} else {
put_set_field(out, ofp_version, MFF_IP_DSCP_SHIFTED, dscp->dscp >> 2);
}
}
| 0 |
[
"CWE-125"
] |
ovs
|
9237a63c47bd314b807cda0bd2216264e82edbe8
| 196,497,806,200,750,800,000,000,000,000,000,000,000 | 9 |
ofp-actions: Avoid buffer overread in BUNDLE action decoding.
Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052
Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Justin Pettit <[email protected]>
|
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string)
{
return cJSON_GetObjectItem(object, string) ? 1 : 0;
}
| 0 |
[
"CWE-754",
"CWE-787"
] |
cJSON
|
be749d7efa7c9021da746e685bd6dec79f9dd99b
| 244,383,015,253,924,930,000,000,000,000,000,000,000 | 4 |
Fix crash of cJSON_GetObjectItemCaseSensitive when calling it on arrays
|
explicit MapUnstageNoKeyOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
| 0 |
[
"CWE-20",
"CWE-476"
] |
tensorflow
|
d7de67733925de196ec8863a33445b73f9562d1d
| 9,388,086,664,650,383,000,000,000,000,000,000,000 | 1 |
Prevent a CHECK-fail due to empty tensor input in `map_stage_op.cc`
PiperOrigin-RevId: 387737906
Change-Id: Idc52df0c71c7ed6e2dd633b651a581932f277c8a
|
InputFile::header () const
{
return _data->header;
}
| 0 |
[
"CWE-125"
] |
openexr
|
e79d2296496a50826a15c667bf92bdc5a05518b4
| 114,037,204,105,134,820,000,000,000,000,000,000,000 | 4 |
fix memory leaks and invalid memory accesses
Signed-off-by: Peter Hillman <[email protected]>
|
GetFileDownloadReadDataErrMsg()
{
char reason[] = "Cannot open file, perhaps it is absent or is a directory";
int reasonLen = strlen(reason);
return CreateFileDownloadErrMsg(reason, reasonLen);
}
| 0 |
[
"CWE-416"
] |
libvncserver
|
73cb96fec028a576a5a24417b57723b55854ad7b
| 66,493,404,250,621,620,000,000,000,000,000,000,000 | 8 |
tightvnc-filetransfer: wait for download thread end in CloseUndoneFileDownload()
...and use it when deregistering the file transfer extension.
Closes #242
|
void ext4_evict_inode(struct inode *inode)
{
handle_t *handle;
int err;
int extra_credits = 3;
struct ext4_xattr_inode_array *ea_inode_array = NULL;
trace_ext4_evict_inode(inode);
if (inode->i_nlink) {
/*
* When journalling data dirty buffers are tracked only in the
* journal. So although mm thinks everything is clean and
* ready for reaping the inode might still have some pages to
* write in the running transaction or waiting to be
* checkpointed. Thus calling jbd2_journal_invalidatepage()
* (via truncate_inode_pages()) to discard these buffers can
* cause data loss. Also even if we did not discard these
* buffers, we would have no way to find them after the inode
* is reaped and thus user could see stale data if he tries to
* read them before the transaction is checkpointed. So be
* careful and force everything to disk here... We use
* ei->i_datasync_tid to store the newest transaction
* containing inode's data.
*
* Note that directories do not have this problem because they
* don't use page cache.
*/
if (inode->i_ino != EXT4_JOURNAL_INO &&
ext4_should_journal_data(inode) &&
(S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
inode->i_data.nrpages) {
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
jbd2_complete_transaction(journal, commit_tid);
filemap_write_and_wait(&inode->i_data);
}
truncate_inode_pages_final(&inode->i_data);
goto no_delete;
}
if (is_bad_inode(inode))
goto no_delete;
dquot_initialize(inode);
if (ext4_should_order_data(inode))
ext4_begin_ordered_truncate(inode, 0);
truncate_inode_pages_final(&inode->i_data);
/*
* Protect us against freezing - iput() caller didn't have to have any
* protection against it
*/
sb_start_intwrite(inode->i_sb);
if (!IS_NOQUOTA(inode))
extra_credits += EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb);
handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE,
ext4_blocks_for_truncate(inode)+extra_credits);
if (IS_ERR(handle)) {
ext4_std_error(inode->i_sb, PTR_ERR(handle));
/*
* If we're going to skip the normal cleanup, we still need to
* make sure that the in-core orphan linked list is properly
* cleaned up.
*/
ext4_orphan_del(NULL, inode);
sb_end_intwrite(inode->i_sb);
goto no_delete;
}
if (IS_SYNC(inode))
ext4_handle_sync(handle);
/*
* Set inode->i_size to 0 before calling ext4_truncate(). We need
* special handling of symlinks here because i_size is used to
* determine whether ext4_inode_info->i_data contains symlink data or
* block mappings. Setting i_size to 0 will remove its fast symlink
* status. Erase i_data so that it becomes a valid empty block map.
*/
if (ext4_inode_is_fast_symlink(inode))
memset(EXT4_I(inode)->i_data, 0, sizeof(EXT4_I(inode)->i_data));
inode->i_size = 0;
err = ext4_mark_inode_dirty(handle, inode);
if (err) {
ext4_warning(inode->i_sb,
"couldn't mark inode dirty (err %d)", err);
goto stop_handle;
}
if (inode->i_blocks) {
err = ext4_truncate(inode);
if (err) {
ext4_error(inode->i_sb,
"couldn't truncate inode %lu (err %d)",
inode->i_ino, err);
goto stop_handle;
}
}
/* Remove xattr references. */
err = ext4_xattr_delete_inode(handle, inode, &ea_inode_array,
extra_credits);
if (err) {
ext4_warning(inode->i_sb, "xattr delete (err %d)", err);
stop_handle:
ext4_journal_stop(handle);
ext4_orphan_del(NULL, inode);
sb_end_intwrite(inode->i_sb);
ext4_xattr_inode_array_free(ea_inode_array);
goto no_delete;
}
/*
* Kill off the orphan record which ext4_truncate created.
* AKPM: I think this can be inside the above `if'.
* Note that ext4_orphan_del() has to be able to cope with the
* deletion of a non-existent orphan - this is because we don't
* know if ext4_truncate() actually created an orphan record.
* (Well, we could do this if we need to, but heck - it works)
*/
ext4_orphan_del(handle, inode);
EXT4_I(inode)->i_dtime = get_seconds();
/*
* One subtle ordering requirement: if anything has gone wrong
* (transaction abort, IO errors, whatever), then we can still
* do these next steps (the fs will already have been marked as
* having errors), but we can't free the inode if the mark_dirty
* fails.
*/
if (ext4_mark_inode_dirty(handle, inode))
/* If that failed, just do the required in-core inode clear. */
ext4_clear_inode(inode);
else
ext4_free_inode(handle, inode);
ext4_journal_stop(handle);
sb_end_intwrite(inode->i_sb);
ext4_xattr_inode_array_free(ea_inode_array);
return;
no_delete:
ext4_clear_inode(inode); /* We must guarantee clearing of inode... */
}
| 0 |
[] |
linux
|
8e4b5eae5decd9dfe5a4ee369c22028f90ab4c44
| 109,941,492,093,316,570,000,000,000,000,000,000,000 | 146 |
ext4: fail ext4_iget for root directory if unallocated
If the root directory has an i_links_count of zero, then when the file
system is mounted, then when ext4_fill_super() notices the problem and
tries to call iput() the root directory in the error return path,
ext4_evict_inode() will try to free the inode on disk, before all of
the file system structures are set up, and this will result in an OOPS
caused by a NULL pointer dereference.
This issue has been assigned CVE-2018-1092.
https://bugzilla.kernel.org/show_bug.cgi?id=199179
https://bugzilla.redhat.com/show_bug.cgi?id=1560777
Reported-by: Wen Xu <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Cc: [email protected]
|
xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type)
{
int has = 0, needVal = 0, normVal = 0;
has = (type->baseType->flags & XML_SCHEMAS_TYPE_HAS_FACETS) ? 1 : 0;
if (has) {
needVal = (type->baseType->flags &
XML_SCHEMAS_TYPE_FACETSNEEDVALUE) ? 1 : 0;
normVal = (type->baseType->flags &
XML_SCHEMAS_TYPE_NORMVALUENEEDED) ? 1 : 0;
}
if (type->facets != NULL) {
xmlSchemaFacetPtr fac;
for (fac = type->facets; fac != NULL; fac = fac->next) {
switch (fac->type) {
case XML_SCHEMA_FACET_WHITESPACE:
break;
case XML_SCHEMA_FACET_PATTERN:
normVal = 1;
has = 1;
break;
case XML_SCHEMA_FACET_ENUMERATION:
needVal = 1;
normVal = 1;
has = 1;
break;
default:
has = 1;
break;
}
}
}
if (normVal)
type->flags |= XML_SCHEMAS_TYPE_NORMVALUENEEDED;
if (needVal)
type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE;
if (has)
type->flags |= XML_SCHEMAS_TYPE_HAS_FACETS;
if (has && (! needVal) && WXS_IS_ATOMIC(type)) {
xmlSchemaTypePtr prim = xmlSchemaGetPrimitiveType(type);
/*
* OPTIMIZE VAL TODO: Some facets need a computed value.
*/
if ((prim->builtInType != XML_SCHEMAS_ANYSIMPLETYPE) &&
(prim->builtInType != XML_SCHEMAS_STRING)) {
type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE;
}
}
}
| 0 |
[
"CWE-134"
] |
libxml2
|
4472c3a5a5b516aaf59b89be602fbce52756c3e9
| 14,003,730,275,498,026,000,000,000,000,000,000,000 | 51 |
Fix some format string warnings with possible format string vulnerability
For https://bugzilla.gnome.org/show_bug.cgi?id=761029
Decorate every method in libxml2 with the appropriate
LIBXML_ATTR_FORMAT(fmt,args) macro and add some cleanups
following the reports.
|
static pdf_t *init_pdf(FILE *fp, const char *name)
{
pdf_t *pdf;
pdf = pdf_new(name);
pdf_get_version(fp, pdf);
if (pdf_load_xrefs(fp, pdf) == -1) {
pdf_delete(pdf);
return NULL;
}
pdf_load_pages_kids(fp, pdf);
return pdf;
}
| 0 |
[
"CWE-787"
] |
pdfresurrect
|
0c4120fffa3dffe97b95c486a120eded82afe8a6
| 194,887,771,471,651,800,000,000,000,000,000,000,000 | 14 |
Zero and sanity check all dynamic allocs.
This addresses the memory issues in Issue #6 expressed in
calloc_some.pdf and malloc_some.pdf
|
int ssl3_get_client_certificate(SSL *s)
{
int i,ok,al,ret= -1;
X509 *x=NULL;
unsigned long l,nc,llen,n;
const unsigned char *p,*q;
unsigned char *d;
STACK_OF(X509) *sk=NULL;
n=s->method->ssl_get_message(s,
SSL3_ST_SR_CERT_A,
SSL3_ST_SR_CERT_B,
-1,
s->max_cert_list,
&ok);
if (!ok) return((int)n);
if (s->s3->tmp.message_type == SSL3_MT_CLIENT_KEY_EXCHANGE)
{
if ( (s->verify_mode & SSL_VERIFY_PEER) &&
(s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT))
{
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);
al=SSL_AD_HANDSHAKE_FAILURE;
goto f_err;
}
/* If tls asked for a client cert, the client must return a 0 list */
if ((s->version > SSL3_VERSION) && s->s3->tmp.cert_request)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST);
al=SSL_AD_UNEXPECTED_MESSAGE;
goto f_err;
}
s->s3->tmp.reuse_message=1;
return(1);
}
if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE)
{
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_WRONG_MESSAGE_TYPE);
goto f_err;
}
p=d=(unsigned char *)s->init_msg;
if ((sk=sk_X509_new_null()) == NULL)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,ERR_R_MALLOC_FAILURE);
goto err;
}
n2l3(p,llen);
if (llen+3 != n)
{
al=SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_LENGTH_MISMATCH);
goto f_err;
}
for (nc=0; nc<llen; )
{
n2l3(p,l);
if ((l+nc+3) > llen)
{
al=SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_CERT_LENGTH_MISMATCH);
goto f_err;
}
q=p;
x=d2i_X509(NULL,&p,l);
if (x == NULL)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,ERR_R_ASN1_LIB);
goto err;
}
if (p != (q+l))
{
al=SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_CERT_LENGTH_MISMATCH);
goto f_err;
}
if (!sk_X509_push(sk,x))
{
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,ERR_R_MALLOC_FAILURE);
goto err;
}
x=NULL;
nc+=l+3;
}
if (sk_X509_num(sk) <= 0)
{
/* TLS does not mind 0 certs returned */
if (s->version == SSL3_VERSION)
{
al=SSL_AD_HANDSHAKE_FAILURE;
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_NO_CERTIFICATES_RETURNED);
goto f_err;
}
/* Fail for TLS only if we required a certificate */
else if ((s->verify_mode & SSL_VERIFY_PEER) &&
(s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT))
{
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);
al=SSL_AD_HANDSHAKE_FAILURE;
goto f_err;
}
}
else
{
i=ssl_verify_cert_chain(s,sk);
if (i <= 0)
{
al=ssl_verify_alarm_type(s->verify_result);
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE,SSL_R_NO_CERTIFICATE_RETURNED);
goto f_err;
}
}
if (s->session->peer != NULL) /* This should not be needed */
X509_free(s->session->peer);
s->session->peer=sk_X509_shift(sk);
s->session->verify_result = s->verify_result;
/* With the current implementation, sess_cert will always be NULL
* when we arrive here. */
if (s->session->sess_cert == NULL)
{
s->session->sess_cert = ssl_sess_cert_new();
if (s->session->sess_cert == NULL)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (s->session->sess_cert->cert_chain != NULL)
sk_X509_pop_free(s->session->sess_cert->cert_chain, X509_free);
s->session->sess_cert->cert_chain=sk;
/* Inconsistency alert: cert_chain does *not* include the
* peer's own certificate, while we do include it in s3_clnt.c */
sk=NULL;
ret=1;
if (0)
{
f_err:
ssl3_send_alert(s,SSL3_AL_FATAL,al);
}
err:
if (x != NULL) X509_free(x);
if (sk != NULL) sk_X509_pop_free(sk,X509_free);
return(ret);
}
| 0 |
[] |
openssl
|
ee2ffc279417f15fef3b1073c7dc81a908991516
| 105,132,238,964,332,000,000,000,000,000,000,000,000 | 155 |
Add Next Protocol Negotiation.
|
static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi__uint16 *dequant)
{
int diff,dc,k;
int t;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
t = stbi__jpeg_huff_decode(j, hdc);
if (t < 0 || t > 15) return stbi__err("bad huffman code","Corrupt JPEG");
// 0 all the ac values now so we can do it 32-bits at a time
memset(data,0,64*sizeof(data[0]));
diff = t ? stbi__extend_receive(j, t) : 0;
dc = j->img_comp[b].dc_pred + diff;
j->img_comp[b].dc_pred = dc;
data[0] = (short) (dc * dequant[0]);
// decode AC components, see JPEG spec
k = 1;
do {
unsigned int zig;
int c,r,s;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
r = fac[c];
if (r) { // fast-AC path
k += (r >> 4) & 15; // run
s = r & 15; // combined length
j->code_buffer <<= s;
j->code_bits -= s;
// decode into unzigzag'd location
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) * dequant[zig]);
} else {
int rs = stbi__jpeg_huff_decode(j, hac);
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (rs != 0xf0) break; // end block
k += 16;
} else {
k += r;
// decode into unzigzag'd location
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]);
}
}
} while (k < 64);
return 1;
}
| 0 |
[
"CWE-787"
] |
stb
|
5ba0baaa269b3fd681828e0e3b3ac0f1472eaf40
| 272,979,811,498,438,860,000,000,000,000,000,000,000 | 51 |
stb_image: Reject fractional JPEG component subsampling ratios
The component resamplers are not written to support this and I've
never seen it happen in a real (non-crafted) JPEG file so I'm
fine rejecting this as outright corrupt.
Fixes issue #1178.
|
DataRcvd(ptcpsess_t *pThis, char *pData, size_t iLen)
{
struct syslogTime stTime;
DEFiRet;
pThis->pLstn->rcvdBytes += iLen;
if(pThis->compressionMode >= COMPRESS_STREAM_ALWAYS)
iRet = DataRcvdCompressed(pThis, pData, iLen);
else
iRet = DataRcvdUncompressed(pThis, pData, iLen, &stTime, 0);
RETiRet;
}
| 0 |
[
"CWE-190"
] |
rsyslog
|
0381a0de64a5a048c3d48b79055bd9848d0c7fc2
| 309,040,434,697,403,330,000,000,000,000,000,000,000 | 11 |
imptcp: fix Segmentation Fault when octet count is to high
|
static int rtrs_rdma_addr_resolved(struct rtrs_clt_con *con)
{
struct rtrs_path *s = con->c.path;
int err;
mutex_lock(&con->con_mutex);
err = create_con_cq_qp(con);
mutex_unlock(&con->con_mutex);
if (err) {
rtrs_err(s, "create_con_cq_qp(), err: %d\n", err);
return err;
}
err = rdma_resolve_route(con->c.cm_id, RTRS_CONNECT_TIMEOUT_MS);
if (err)
rtrs_err(s, "Resolving route failed, err: %d\n", err);
return err;
}
| 0 |
[
"CWE-415"
] |
linux
|
8700af2cc18c919b2a83e74e0479038fd113c15d
| 67,297,953,177,290,650,000,000,000,000,000,000,000 | 18 |
RDMA/rtrs-clt: Fix possible double free in error case
Callback function rtrs_clt_dev_release() for put_device() calls kfree(clt)
to free memory. We shouldn't call kfree(clt) again, and we can't use the
clt after kfree too.
Replace device_register() with device_initialize() and device_add() so that
dev_set_name can() be used appropriately.
Move mutex_destroy() to the release function so it can be called in
the alloc_clt err path.
Fixes: eab098246625 ("RDMA/rtrs-clt: Refactor the failure cases in alloc_clt")
Link: https://lore.kernel.org/r/[email protected]
Reported-by: Miaoqian Lin <[email protected]>
Signed-off-by: Md Haris Iqbal <[email protected]>
Reviewed-by: Jack Wang <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
|
static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page,
struct list_head *list)
{
gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE;
int nid = page_to_nid(old_page);
bool alloc_retry = false;
struct page *new_page;
int ret = 0;
/*
* Before dissolving the page, we need to allocate a new one for the
* pool to remain stable. Here, we allocate the page and 'prep' it
* by doing everything but actually updating counters and adding to
* the pool. This simplifies and let us do most of the processing
* under the lock.
*/
alloc_retry:
new_page = alloc_buddy_huge_page(h, gfp_mask, nid, NULL, NULL);
if (!new_page)
return -ENOMEM;
/*
* If all goes well, this page will be directly added to the free
* list in the pool. For this the ref count needs to be zero.
* Attempt to drop now, and retry once if needed. It is VERY
* unlikely there is another ref on the page.
*
* If someone else has a reference to the page, it will be freed
* when they drop their ref. Abuse temporary page flag to accomplish
* this. Retry once if there is an inflated ref count.
*/
SetHPageTemporary(new_page);
if (!put_page_testzero(new_page)) {
if (alloc_retry)
return -EBUSY;
alloc_retry = true;
goto alloc_retry;
}
ClearHPageTemporary(new_page);
__prep_new_huge_page(h, new_page);
retry:
spin_lock_irq(&hugetlb_lock);
if (!PageHuge(old_page)) {
/*
* Freed from under us. Drop new_page too.
*/
goto free_new;
} else if (page_count(old_page)) {
/*
* Someone has grabbed the page, try to isolate it here.
* Fail with -EBUSY if not possible.
*/
spin_unlock_irq(&hugetlb_lock);
if (!isolate_huge_page(old_page, list))
ret = -EBUSY;
spin_lock_irq(&hugetlb_lock);
goto free_new;
} else if (!HPageFreed(old_page)) {
/*
* Page's refcount is 0 but it has not been enqueued in the
* freelist yet. Race window is small, so we can succeed here if
* we retry.
*/
spin_unlock_irq(&hugetlb_lock);
cond_resched();
goto retry;
} else {
/*
* Ok, old_page is still a genuine free hugepage. Remove it from
* the freelist and decrease the counters. These will be
* incremented again when calling __prep_account_new_huge_page()
* and enqueue_huge_page() for new_page. The counters will remain
* stable since this happens under the lock.
*/
remove_hugetlb_page(h, old_page, false);
/*
* Ref count on new page is already zero as it was dropped
* earlier. It can be directly added to the pool free list.
*/
__prep_account_new_huge_page(h, nid);
enqueue_huge_page(h, new_page);
/*
* Pages have been replaced, we can safely free the old one.
*/
spin_unlock_irq(&hugetlb_lock);
update_and_free_page(h, old_page, false);
}
return ret;
free_new:
spin_unlock_irq(&hugetlb_lock);
/* Page has a zero ref count, but needs a ref to be freed */
set_page_refcounted(new_page);
update_and_free_page(h, new_page, false);
return ret;
}
| 0 |
[] |
linux
|
a4a118f2eead1d6c49e00765de89878288d4b890
| 267,956,162,040,242,800,000,000,000,000,000,000,000 | 102 |
hugetlbfs: flush TLBs correctly after huge_pmd_unshare
When __unmap_hugepage_range() calls to huge_pmd_unshare() succeed, a TLB
flush is missing. This TLB flush must be performed before releasing the
i_mmap_rwsem, in order to prevent an unshared PMDs page from being
released and reused before the TLB flush took place.
Arguably, a comprehensive solution would use mmu_gather interface to
batch the TLB flushes and the PMDs page release, however it is not an
easy solution: (1) try_to_unmap_one() and try_to_migrate_one() also call
huge_pmd_unshare() and they cannot use the mmu_gather interface; and (2)
deferring the release of the page reference for the PMDs page until
after i_mmap_rwsem is dropeed can confuse huge_pmd_unshare() into
thinking PMDs are shared when they are not.
Fix __unmap_hugepage_range() by adding the missing TLB flush, and
forcing a flush when unshare is successful.
Fixes: 24669e58477e ("hugetlb: use mmu_gather instead of a temporary linked list for accumulating pages)" # 3.6
Signed-off-by: Nadav Amit <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Cc: Aneesh Kumar K.V <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
static void sock_def_wakeup(struct sock *sk)
{
struct socket_wq *wq;
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up_interruptible_all(&wq->wait);
rcu_read_unlock();
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
linux
|
b98b0bc8c431e3ceb4b26b0dfc8db509518fb290
| 227,143,579,505,095,480,000,000,000,000,000,000,000 | 10 |
net: avoid signed overflows for SO_{SND|RCV}BUFFORCE
CAP_NET_ADMIN users should not be allowed to set negative
sk_sndbuf or sk_rcvbuf values, as it can lead to various memory
corruptions, crashes, OOM...
Note that before commit 82981930125a ("net: cleanups in
sock_setsockopt()"), the bug was even more serious, since SO_SNDBUF
and SO_RCVBUF were vulnerable.
This needs to be backported to all known linux kernels.
Again, many thanks to syzkaller team for discovering this gem.
Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: Andrey Konovalov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
_equalVariableShowStmt(const VariableShowStmt *a, const VariableShowStmt *b)
{
COMPARE_STRING_FIELD(name);
return true;
}
| 0 |
[
"CWE-362"
] |
postgres
|
5f173040e324f6c2eebb90d86cf1b0cdb5890f0a
| 252,954,693,772,989,300,000,000,000,000,000,000,000 | 6 |
Avoid repeated name lookups during table and index DDL.
If the name lookups come to different conclusions due to concurrent
activity, we might perform some parts of the DDL on a different table
than other parts. At least in the case of CREATE INDEX, this can be
used to cause the permissions checks to be performed against a
different table than the index creation, allowing for a privilege
escalation attack.
This changes the calling convention for DefineIndex, CreateTrigger,
transformIndexStmt, transformAlterTableStmt, CheckIndexCompatible
(in 9.2 and newer), and AlterTable (in 9.1 and older). In addition,
CheckRelationOwnership is removed in 9.2 and newer and the calling
convention is changed in older branches. A field has also been added
to the Constraint node (FkConstraint in 8.4). Third-party code calling
these functions or using the Constraint node will require updating.
Report by Andres Freund. Patch by Robert Haas and Andres Freund,
reviewed by Tom Lane.
Security: CVE-2014-0062
|
add_account (GoaProvider *provider,
GoaClient *client,
GtkDialog *dialog,
GtkBox *vbox,
GError **error)
{
AddAccountData data;
GVariantBuilder credentials;
GVariantBuilder details;
GoaHttpClient *http_client;
GoaObject *ret;
gboolean accept_ssl_errors;
const gchar *uri_text;
const gchar *password;
const gchar *username;
const gchar *provider_type;
gchar *presentation_identity;
gchar *server;
gchar *uri;
gchar *uri_webdav;
gint response;
http_client = NULL;
accept_ssl_errors = FALSE;
presentation_identity = NULL;
server = NULL;
uri = NULL;
ret = NULL;
memset (&data, 0, sizeof (AddAccountData));
data.cancellable = g_cancellable_new ();
data.loop = g_main_loop_new (NULL, FALSE);
data.dialog = dialog;
data.error = NULL;
create_account_details_ui (provider, dialog, vbox, TRUE, &data);
gtk_widget_show_all (GTK_WIDGET (vbox));
g_signal_connect (dialog, "response", G_CALLBACK (dialog_response_cb), &data);
http_client = goa_http_client_new ();
http_again:
response = gtk_dialog_run (dialog);
if (response != GTK_RESPONSE_OK)
{
g_set_error (&data.error,
GOA_ERROR,
GOA_ERROR_DIALOG_DISMISSED,
_("Dialog was dismissed"));
goto out;
}
uri_text = gtk_entry_get_text (GTK_ENTRY (data.uri));
username = gtk_entry_get_text (GTK_ENTRY (data.username));
password = gtk_entry_get_text (GTK_ENTRY (data.password));
/* See if there's already an account of this type with the
* given identity
*/
provider_type = goa_provider_get_provider_type (provider);
if (!goa_utils_check_duplicate (client,
username,
provider_type,
(GoaPeekInterfaceFunc) goa_object_peek_password_based,
&data.error))
goto out;
uri = normalize_uri (uri_text, &server);
uri_webdav = g_strconcat (uri, WEBDAV_ENDPOINT, NULL);
g_cancellable_reset (data.cancellable);
goa_http_client_check (http_client,
uri_webdav,
username,
password,
accept_ssl_errors,
data.cancellable,
check_cb,
&data);
g_free (uri_webdav);
gtk_widget_set_sensitive (data.connect_button, FALSE);
gtk_widget_show (data.progress_grid);
g_main_loop_run (data.loop);
if (g_cancellable_is_cancelled (data.cancellable))
{
g_prefix_error (&data.error,
_("Dialog was dismissed (%s, %d): "),
g_quark_to_string (data.error->domain),
data.error->code);
data.error->domain = GOA_ERROR;
data.error->code = GOA_ERROR_DIALOG_DISMISSED;
goto out;
}
else if (data.error != NULL)
{
gchar *markup;
if (data.error->code == GOA_ERROR_SSL)
{
gtk_button_set_label (GTK_BUTTON (data.connect_button), _("_Ignore"));
accept_ssl_errors = TRUE;
}
else
{
gtk_button_set_label (GTK_BUTTON (data.connect_button), _("_Try Again"));
accept_ssl_errors = FALSE;
}
markup = g_strdup_printf ("<b>%s:</b> %s",
_("Error connecting to ownCloud server"),
data.error->message);
g_clear_error (&data.error);
gtk_label_set_markup (GTK_LABEL (data.cluebar_label), markup);
g_free (markup);
gtk_widget_set_no_show_all (data.cluebar, FALSE);
gtk_widget_show_all (data.cluebar);
g_clear_pointer (&server, g_free);
g_clear_pointer (&uri, g_free);
goto http_again;
}
gtk_widget_hide (GTK_WIDGET (dialog));
g_variant_builder_init (&credentials, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&credentials, "{sv}", "password", g_variant_new_string (password));
g_variant_builder_init (&details, G_VARIANT_TYPE ("a{ss}"));
g_variant_builder_add (&details, "{ss}", "CalendarEnabled", "true");
g_variant_builder_add (&details, "{ss}", "ContactsEnabled", "true");
g_variant_builder_add (&details, "{ss}", "FilesEnabled", "true");
g_variant_builder_add (&details, "{ss}", "Uri", uri);
g_variant_builder_add (&details, "{ss}", "AcceptSslErrors", (accept_ssl_errors) ? "true" : "false");
/* OK, everything is dandy, add the account */
/* we want the GoaClient to update before this method returns (so it
* can create a proxy for the new object) so run the mainloop while
* waiting for this to complete
*/
presentation_identity = g_strconcat (username, "@", server, NULL);
goa_manager_call_add_account (goa_client_get_manager (client),
goa_provider_get_provider_type (provider),
username,
presentation_identity,
g_variant_builder_end (&credentials),
g_variant_builder_end (&details),
NULL, /* GCancellable* */
(GAsyncReadyCallback) add_account_cb,
&data);
g_main_loop_run (data.loop);
if (data.error != NULL)
goto out;
ret = GOA_OBJECT (g_dbus_object_manager_get_object (goa_client_get_object_manager (client),
data.account_object_path));
out:
/* We might have an object even when data.error is set.
* eg., if we failed to store the credentials in the keyring.
*/
if (data.error != NULL)
g_propagate_error (error, data.error);
else
g_assert (ret != NULL);
g_free (presentation_identity);
g_free (server);
g_free (uri);
g_free (data.account_object_path);
if (data.loop != NULL)
g_main_loop_unref (data.loop);
g_clear_object (&data.cancellable);
g_clear_object (&http_client);
return ret;
}
| 0 |
[
"CWE-310"
] |
gnome-online-accounts
|
edde7c63326242a60a075341d3fea0be0bc4d80e
| 110,852,330,694,890,670,000,000,000,000,000,000,000 | 179 |
Guard against invalid SSL certificates
None of the branded providers (eg., Google, Facebook and Windows Live)
should ever have an invalid certificate. So set "ssl-strict" on the
SoupSession object being used by GoaWebView.
Providers like ownCloud and Exchange might have to deal with
certificates that are not up to the mark. eg., self-signed
certificates. For those, show a warning when the account is being
created, and only proceed if the user decides to ignore it. In any
case, save the status of the certificate that was used to create the
account. So an account created with a valid certificate will never
work with an invalid one, and one created with an invalid certificate
will not throw any further warnings.
Fixes: CVE-2013-0240
|
static bool __f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct extent_tree *et;
struct extent_node *en;
struct extent_info ei;
if (!f2fs_may_extent_tree(inode)) {
/* drop largest extent */
if (i_ext && i_ext->len) {
i_ext->len = 0;
return true;
}
return false;
}
et = __grab_extent_tree(inode);
if (!i_ext || !i_ext->len)
return false;
get_extent_info(&ei, i_ext);
write_lock(&et->lock);
if (atomic_read(&et->node_cnt))
goto out;
en = __init_extent_tree(sbi, et, &ei);
if (en) {
spin_lock(&sbi->extent_lock);
list_add_tail(&en->list, &sbi->extent_list);
spin_unlock(&sbi->extent_lock);
}
out:
write_unlock(&et->lock);
return false;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
linux
|
dad48e73127ba10279ea33e6dbc8d3905c4d31c0
| 263,410,167,694,025,230,000,000,000,000,000,000,000 | 37 |
f2fs: fix a bug caused by NULL extent tree
Thread A: Thread B:
-f2fs_remount
-sbi->mount_opt.opt = 0;
<--- -f2fs_iget
-do_read_inode
-f2fs_init_extent_tree
-F2FS_I(inode)->extent_tree is NULL
-default_options && parse_options
-remount return
<--- -f2fs_map_blocks
-f2fs_lookup_extent_tree
-f2fs_bug_on(sbi, !et);
The same problem with f2fs_new_inode.
Signed-off-by: Yunlei He <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
|
const char* ExpressionTrunc::getOpName() const {
return "$trunc";
}
| 0 |
[
"CWE-835"
] |
mongo
|
0a076417d1d7fba3632b73349a1fd29a83e68816
| 269,829,205,069,930,080,000,000,000,000,000,000,000 | 3 |
SERVER-38070 fix infinite loop in agg expression
|
ivq_safelevel_handler(arg, ivq)
VALUE arg;
VALUE ivq;
{
struct invoke_queue *q;
Data_Get_Struct(ivq, struct invoke_queue, q);
DUMP2("(safe-level handler) $SAFE = %d", q->safe_level);
rb_set_safe_level(q->safe_level);
return ip_invoke_core(q->interp, q->argc, q->argv);
}
| 0 |
[] |
tk
|
ebd0fc80d62eeb7b8556522256f8d035e013eb65
| 154,919,848,356,941,010,000,000,000,000,000,000,000 | 11 |
tcltklib.c: check argument
* ext/tk/tcltklib.c (ip_cancel_eval_core): check argument type and
length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
static bool check_buffer(RBinFile *bf, RBuffer *b) {
if (r_buf_size (b) >= 0x20) {
ut8 magic[4] = {0};
if (r_buf_read_at (b, 0, magic, sizeof (magic)) != 4) {
return false;
}
return !memcmp (magic, "XALZ", 4);
}
return false;
}
| 0 |
[
"CWE-125"
] |
radare2
|
fc285cecb8469f0262db0170bf6dd7c01d9b8ed5
| 312,197,566,493,198,900,000,000,000,000,000,000,000 | 10 |
Fix #20354
|
static void on_comment_changed(GtkTextBuffer *buffer, gpointer user_data)
{
toggle_eb_comment();
}
| 0 |
[
"CWE-200"
] |
libreport
|
257578a23d1537a2d235aaa2b1488ee4f818e360
| 118,607,020,191,058,960,000,000,000,000,000,000,000 | 4 |
wizard: fix save users changes after reviewing dump dir files
If the user reviewed the dump dir's files during reporting the crash, the
changes was thrown away and original data was passed to the bugzilla bug
report.
report-gtk saves the first text view buffer and then reloads data from the
reported problem directory, which causes that the changes made to those text
views are thrown away.
Function save_text_if_changed(), except of saving text, also reload the files
from dump dir and update gui state from the dump dir. The commit moves the
reloading and updating gui functions away from this function.
Related to rhbz#1270235
Signed-off-by: Matej Habrnal <[email protected]>
|
errno_t sssctl_logs_remove(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
{
struct sssctl_logs_opts opts = {0};
errno_t ret;
glob_t globbuf;
/* Parse command line. */
struct poptOption options[] = {
{"delete", 'd', POPT_ARG_NONE, &opts.delete, 0, _("Delete log files instead of truncating"), NULL },
POPT_TABLEEND
};
ret = sss_tool_popt(cmdline, options, SSS_TOOL_OPT_OPTIONAL, NULL, NULL);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, "Unable to parse command arguments\n");
return ret;
}
if (opts.delete) {
PRINT("Deleting log files...\n");
ret = sss_remove_subtree(LOG_PATH);
if (ret != EOK) {
ERROR("Unable to remove log files\n");
return ret;
}
sss_signal(SIGHUP);
} else {
globbuf.gl_offs = 4;
ret = glob(LOG_PATH"/*.log", GLOB_ERR|GLOB_DOOFFS, NULL, &globbuf);
if (ret != 0) {
DEBUG(SSSDBG_CRIT_FAILURE, "Unable to expand log files list\n");
return ret;
}
globbuf.gl_pathv[0] = discard_const_p(char, "truncate");
globbuf.gl_pathv[1] = discard_const_p(char, "--no-create");
globbuf.gl_pathv[2] = discard_const_p(char, "--size");
globbuf.gl_pathv[3] = discard_const_p(char, "0");
PRINT("Truncating log files...\n");
ret = sssctl_run_command((const char * const*)globbuf.gl_pathv);
globfree(&globbuf);
if (ret != EOK) {
ERROR("Unable to truncate log files\n");
return ret;
}
}
return EOK;
}
| 0 |
[
"CWE-78"
] |
sssd
|
7ab83f97e1cbefb78ece17232185bdd2985f0bbe
| 336,220,768,478,019,200,000,000,000,000,000,000,000 | 52 |
TOOLS: replace system() with execvp() to avoid execution of user supplied command
:relnote: A flaw was found in SSSD, where the sssctl command was
vulnerable to shell command injection via the logs-fetch and
cache-expire subcommands. This flaw allows an attacker to trick
the root user into running a specially crafted sssctl command,
such as via sudo, to gain root access. The highest threat from this
vulnerability is to confidentiality, integrity, as well as system
availability.
This patch fixes a flaw by replacing system() with execvp().
:fixes: CVE-2021-3621
Reviewed-by: Pavel Březina <[email protected]>
|
SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname)
{
return sys_symlinkat(oldname, AT_FDCWD, newname);
}
| 0 |
[
"CWE-20",
"CWE-362",
"CWE-416"
] |
linux
|
86acdca1b63e6890540fa19495cfc708beff3d8b
| 25,496,315,543,566,116,000,000,000,000,000,000,000 | 4 |
fix autofs/afs/etc. magic mountpoint breakage
We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT)
if /mnt/tmp is an autofs direct mount. The reason is that nd.last_type
is bogus here; we want LAST_BIND for everything of that kind and we
get LAST_NORM left over from finding parent directory.
So make sure that it *is* set properly; set to LAST_BIND before
doing ->follow_link() - for normal symlinks it will be changed
by __vfs_follow_link() and everything else needs it set that way.
Signed-off-by: Al Viro <[email protected]>
|
int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr,
int threadnr, int is_vp7)
{
VP8Context *s = avctx->priv_data;
VP8ThreadData *td = &s->thread_data[jobnr];
VP8ThreadData *next_td = NULL, *prev_td = NULL;
VP8Frame *curframe = s->curframe;
int mb_y, num_jobs = s->num_jobs;
int ret;
td->thread_nr = threadnr;
td->mv_bounds.mv_min.y = -MARGIN - 64 * threadnr;
td->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN - 64 * threadnr;
for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) {
atomic_store(&td->thread_mb_pos, mb_y << 16);
ret = s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr);
if (ret < 0) {
update_pos(td, s->mb_height, INT_MAX & 0xFFFF);
return ret;
}
if (s->deblock_filter)
s->filter_mb_row(avctx, tdata, jobnr, threadnr);
update_pos(td, mb_y, INT_MAX & 0xFFFF);
td->mv_bounds.mv_min.y -= 64 * num_jobs;
td->mv_bounds.mv_max.y -= 64 * num_jobs;
if (avctx->active_thread_type == FF_THREAD_FRAME)
ff_thread_report_progress(&curframe->tf, mb_y, 0);
}
return 0;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
FFmpeg
|
6b5d3fb26fb4be48e4966e4b1d97c2165538d4ef
| 172,994,371,872,271,020,000,000,000,000,000,000,000 | 33 |
avcodec/webp: Always set pix_fmt
Fixes: out of array access
Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632
Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: "Ronald S. Bultje" <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
|
static void set_sock_ids(struct mdesc_handle *hp)
{
u64 mp;
/**
* Find the highest level of shared cache which pre-T7 is also
* the socket.
*/
if (!set_max_cache_ids_by_cache(hp, 3))
set_max_cache_ids_by_cache(hp, 2);
/* If machine description exposes sockets data use it.*/
mp = mdesc_node_by_name(hp, MDESC_NODE_NULL, "sockets");
if (mp != MDESC_NODE_NULL)
set_sock_ids_by_socket(hp, mp);
}
| 0 |
[
"CWE-476"
] |
sparc
|
80caf43549e7e41a695c6d1e11066286538b336f
| 272,531,240,816,868,560,000,000,000,000,000,000,000 | 16 |
mdesc: fix a missing-check bug in get_vdev_port_node_info()
In get_vdev_port_node_info(), 'node_info->vdev_port.name' is allcoated
by kstrdup_const(), and it returns NULL when fails. So
'node_info->vdev_port.name' should be checked.
Signed-off-by: Gen Zhang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
GF_Err odtt_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_OMADRMTransactionTrackingBox *ptr = (GF_OMADRMTransactionTrackingBox *)s;
gf_bs_read_data(bs, ptr->TransactionID, 16);
ISOM_DECREASE_SIZE(ptr, 16);
return GF_OK;
}
| 0 |
[
"CWE-703"
] |
gpac
|
f19668964bf422cf5a63e4dbe1d3c6c75edadcbb
| 323,729,880,326,953,060,000,000,000,000,000,000,000 | 8 |
fixed #1879
|
static void smack_sk_free_security(struct sock *sk)
{
#ifdef SMACK_IPV6_PORT_LABELING
struct smk_port_label *spp;
if (sk->sk_family == PF_INET6) {
rcu_read_lock();
list_for_each_entry_rcu(spp, &smk_ipv6_port_list, list) {
if (spp->smk_sock != sk)
continue;
spp->smk_can_reuse = 1;
break;
}
rcu_read_unlock();
}
#endif
kfree(sk->sk_security);
}
| 0 |
[
"CWE-416"
] |
linux
|
a3727a8bac0a9e77c70820655fd8715523ba3db7
| 170,632,512,738,199,870,000,000,000,000,000,000,000 | 18 |
selinux,smack: fix subjective/objective credential use mixups
Jann Horn reported a problem with commit eb1231f73c4d ("selinux:
clarify task subjective and objective credentials") where some LSM
hooks were attempting to access the subjective credentials of a task
other than the current task. Generally speaking, it is not safe to
access another task's subjective credentials and doing so can cause
a number of problems.
Further, while looking into the problem, I realized that Smack was
suffering from a similar problem brought about by a similar commit
1fb057dcde11 ("smack: differentiate between subjective and objective
task credentials").
This patch addresses this problem by restoring the use of the task's
objective credentials in those cases where the task is other than the
current executing task. Not only does this resolve the problem
reported by Jann, it is arguably the correct thing to do in these
cases.
Cc: [email protected]
Fixes: eb1231f73c4d ("selinux: clarify task subjective and objective credentials")
Fixes: 1fb057dcde11 ("smack: differentiate between subjective and objective task credentials")
Reported-by: Jann Horn <[email protected]>
Acked-by: Eric W. Biederman <[email protected]>
Acked-by: Casey Schaufler <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
|
struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
struct user_namespace *user_ns, struct fs_struct *new_fs)
{
struct mnt_namespace *new_ns;
struct vfsmount *rootmnt = NULL, *pwdmnt = NULL;
struct mount *p, *q;
struct mount *old;
struct mount *new;
int copy_flags;
BUG_ON(!ns);
if (likely(!(flags & CLONE_NEWNS))) {
get_mnt_ns(ns);
return ns;
}
old = ns->root;
new_ns = alloc_mnt_ns(user_ns);
if (IS_ERR(new_ns))
return new_ns;
namespace_lock();
/* First pass: copy the tree topology */
copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;
if (user_ns != ns->user_ns)
copy_flags |= CL_SHARED_TO_SLAVE | CL_UNPRIVILEGED;
new = copy_tree(old, old->mnt.mnt_root, copy_flags);
if (IS_ERR(new)) {
namespace_unlock();
free_mnt_ns(new_ns);
return ERR_CAST(new);
}
new_ns->root = new;
list_add_tail(&new_ns->list, &new->mnt_list);
/*
* Second pass: switch the tsk->fs->* elements and mark new vfsmounts
* as belonging to new namespace. We have already acquired a private
* fs_struct, so tsk->fs->lock is not needed.
*/
p = old;
q = new;
while (p) {
q->mnt_ns = new_ns;
new_ns->mounts++;
if (new_fs) {
if (&p->mnt == new_fs->root.mnt) {
new_fs->root.mnt = mntget(&q->mnt);
rootmnt = &p->mnt;
}
if (&p->mnt == new_fs->pwd.mnt) {
new_fs->pwd.mnt = mntget(&q->mnt);
pwdmnt = &p->mnt;
}
}
p = next_mnt(p, old);
q = next_mnt(q, new);
if (!q)
break;
while (p->mnt.mnt_root != q->mnt.mnt_root)
p = next_mnt(p, old);
}
namespace_unlock();
if (rootmnt)
mntput(rootmnt);
if (pwdmnt)
mntput(pwdmnt);
return new_ns;
}
| 0 |
[
"CWE-400",
"CWE-703"
] |
linux
|
d29216842a85c7970c536108e093963f02714498
| 145,691,244,862,461,800,000,000,000,000,000,000,000 | 73 |
mnt: Add a per mount namespace limit on the number of mounts
CAI Qian <[email protected]> pointed out that the semantics
of shared subtrees make it possible to create an exponentially
increasing number of mounts in a mount namespace.
mkdir /tmp/1 /tmp/2
mount --make-rshared /
for i in $(seq 1 20) ; do mount --bind /tmp/1 /tmp/2 ; done
Will create create 2^20 or 1048576 mounts, which is a practical problem
as some people have managed to hit this by accident.
As such CVE-2016-6213 was assigned.
Ian Kent <[email protected]> described the situation for autofs users
as follows:
> The number of mounts for direct mount maps is usually not very large because of
> the way they are implemented, large direct mount maps can have performance
> problems. There can be anywhere from a few (likely case a few hundred) to less
> than 10000, plus mounts that have been triggered and not yet expired.
>
> Indirect mounts have one autofs mount at the root plus the number of mounts that
> have been triggered and not yet expired.
>
> The number of autofs indirect map entries can range from a few to the common
> case of several thousand and in rare cases up to between 30000 and 50000. I've
> not heard of people with maps larger than 50000 entries.
>
> The larger the number of map entries the greater the possibility for a large
> number of active mounts so it's not hard to expect cases of a 1000 or somewhat
> more active mounts.
So I am setting the default number of mounts allowed per mount
namespace at 100,000. This is more than enough for any use case I
know of, but small enough to quickly stop an exponential increase
in mounts. Which should be perfect to catch misconfigurations and
malfunctioning programs.
For anyone who needs a higher limit this can be changed by writing
to the new /proc/sys/fs/mount-max sysctl.
Tested-by: CAI Qian <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
|
static int rar5_has_encrypted_entries(struct archive_read *_a) {
(void) _a;
/* Unsupported for now. */
return ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED;
}
| 0 |
[
"CWE-20",
"CWE-125"
] |
libarchive
|
94821008d6eea81e315c5881cdf739202961040a
| 135,514,286,564,350,130,000,000,000,000,000,000,000 | 6 |
RAR5 reader: reject files that declare invalid header flags
One of the fields in RAR5's base block structure is the size of the
header. Some invalid files declare a 0 header size setting, which can
confuse the unpacker. Minimum header size for RAR5 base blocks is 7
bytes (4 bytes for CRC, and 3 bytes for the rest), so block size of 0
bytes should be rejected at header parsing stage.
The fix adds an error condition if header size of 0 bytes is detected.
In this case, the unpacker will not attempt to unpack the file, as the
header is corrupted.
The commit also adds OSSFuzz #20459 sample to test further regressions
in this area.
|
static void buf_sent(int err, void *user_data)
{
if (atomic_test_and_clear_bit(link.flags, ADV_LINK_CLOSING)) {
close_link(PROV_BEARER_LINK_STATUS_SUCCESS);
return;
}
}
| 0 |
[
"CWE-787"
] |
zephyr
|
6ec31c852049641095f2cdf25591f2e1bff86774
| 221,221,058,814,192,060,000,000,000,000,000,000,000 | 7 |
Bluetooth: Mesh: Check SegN when receiving Transaction Start PDU
When receiving Transaction Start PDU, assure that number of segments
needed to send a Provisioning PDU with TotalLength size is equal to SegN
value provided in the Transaction Start PDU.
Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit a63c51567991ded3939bbda4f82bcb8c44228331)
|
dwg_decode_xdata (Bit_Chain *restrict dat, Dwg_Object_XRECORD *restrict obj,
BITCODE_BL size)
{
Dwg_Resbuf *rbuf, *root = NULL, *curr = NULL;
unsigned char codepage;
long unsigned int end_address, curr_address;
BITCODE_BL i, num_xdata = 0;
BITCODE_RS length;
int error;
static int cnt = 0;
cnt++;
end_address = dat->byte + (unsigned long int)size;
if (obj->parent && obj->parent->objid)
{
Dwg_Data *dwg = obj->parent->dwg;
Dwg_Object *o = &dwg->object[obj->parent->objid];
if (size > o->size)
{
LOG_ERROR ("Invalid XRECORD.num_databytes " FORMAT_BL, size);
obj->num_databytes = 0;
return NULL;
}
}
LOG_INSANE ("xdata:\n");
LOG_INSANE_TF (&dat->chain[dat->byte], (int)size);
curr_address = dat->byte;
while (dat->byte < end_address)
{
enum RES_BUF_VALUE_TYPE vtype;
rbuf = (Dwg_Resbuf *)calloc (1, sizeof (Dwg_Resbuf));
if (!rbuf)
{
LOG_ERROR ("Out of memory");
dwg_free_xdata_resbuf (root);
return NULL;
}
rbuf->next = NULL;
rbuf->type = bit_read_RS (dat);
if (dat->byte == curr_address)
{
// no advance, by dat overflow
dat->byte = end_address;
break;
}
if (rbuf->type < 0 || rbuf->type >= 2000)
{
LOG_ERROR ("Invalid xdata type %d [RS]", rbuf->type);
dat->byte = end_address;
break;
}
vtype = get_base_value_type (rbuf->type);
switch (vtype)
{
case VT_STRING:
PRE (R_2007)
{
length = rbuf->value.str.size = bit_read_RS (dat);
rbuf->value.str.codepage = bit_read_RC (dat);
if (length > size)
break;
rbuf->value.str.u.data = bit_read_TF (dat, length);
LOG_TRACE ("xdata[%d]: \"%s\" [TF %d %d]\n", num_xdata,
rbuf->value.str.u.data, length, rbuf->type);
}
LATER_VERSIONS
{
length = rbuf->value.str.size = bit_read_RS (dat);
if (length > 0 && length < size)
{
rbuf->value.str.u.wdata = calloc (length + 1, 2);
if (!rbuf->value.str.u.wdata)
{
LOG_ERROR ("Out of memory");
if (root)
{
dwg_free_xdata_resbuf (root);
if (rbuf)
free (rbuf);
}
else
dwg_free_xdata_resbuf (rbuf);
return NULL;
}
for (i = 0; i < length; i++)
rbuf->value.str.u.wdata[i] = bit_read_RS (dat);
rbuf->value.str.u.wdata[i] = '\0';
LOG_TRACE_TU ("xdata", rbuf->value.str.u.wdata, rbuf->type);
}
}
break;
case VT_REAL:
rbuf->value.dbl = bit_read_RD (dat);
LOG_TRACE ("xdata[%d]: %f [RD %d]\n", num_xdata, rbuf->value.dbl,
rbuf->type);
break;
case VT_BOOL:
case VT_INT8:
rbuf->value.i8 = bit_read_RC (dat);
LOG_TRACE ("xdata[%d]: %d [RC %d]\n", num_xdata, (int)rbuf->value.i8,
rbuf->type);
break;
case VT_INT16:
rbuf->value.i16 = bit_read_RS (dat);
LOG_TRACE ("xdata[%d]: %d [RS %d]\n", num_xdata,
(int)rbuf->value.i16, rbuf->type);
break;
case VT_INT32:
rbuf->value.i32 = bit_read_RL (dat);
LOG_TRACE ("xdata[%d]: %d [RL %d]\n", num_xdata,
(int)rbuf->value.i32, rbuf->type);
break;
case VT_INT64:
rbuf->value.i64 = bit_read_BLL (dat);
LOG_TRACE ("xdata[%d]: " FORMAT_BLL " [BLL %d]\n", num_xdata,
rbuf->value.i64, rbuf->type);
break;
case VT_POINT3D:
rbuf->value.pt[0] = bit_read_RD (dat);
rbuf->value.pt[1] = bit_read_RD (dat);
rbuf->value.pt[2] = bit_read_RD (dat);
LOG_TRACE ("xdata[%d]: %f,%f,%f [3RD %d]\n", num_xdata,
rbuf->value.pt[0], rbuf->value.pt[1], rbuf->value.pt[2],
rbuf->type);
break;
case VT_BINARY:
rbuf->value.str.size = bit_read_RC (dat);
rbuf->value.str.u.data = bit_read_TF (dat, rbuf->value.str.size);
LOG_TRACE ("xdata[%d]: [TF %d %d]", num_xdata, rbuf->value.str.size,
rbuf->type);
LOG_TRACE_TF (rbuf->value.str.u.data, rbuf->value.str.size);
break;
case VT_HANDLE:
case VT_OBJECTID:
bit_read_fixed (dat, rbuf->value.hdl, 8);
LOG_TRACE ("xdata[%d]: %X [H %d]\n", num_xdata,
(unsigned)*(uint64_t *)rbuf->value.hdl, rbuf->type);
break;
case VT_INVALID:
default:
LOG_ERROR ("Invalid group code in xdata[%d]: %d", num_xdata,
rbuf->type)
dwg_free_xdata_resbuf (rbuf);
dat->byte = end_address;
obj->num_xdata = num_xdata;
return root;
}
num_xdata++;
if (!curr)
{
curr = root = rbuf;
}
else
{
curr->next = rbuf;
curr = rbuf;
}
curr_address = dat->byte;
}
obj->num_xdata = num_xdata;
return root;
}
| 0 |
[
"CWE-703",
"CWE-835"
] |
libredwg
|
c6f6668b82bfe595899cc820279ac37bb9ef16f5
| 67,454,588,638,921,850,000,000,000,000,000,000,000 | 165 |
cleanup tio.unknown
not needed anymore, we only have UNKNOWN_OBJ or UNKNOWN_ENT with full common
entity_data.
Fixes GH #178 heap_overflow2
|
cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset)
{
int rc = -EACCES;
unsigned int bytes_read = 0;
unsigned int total_read;
unsigned int current_read_size;
unsigned int rsize;
struct cifs_sb_info *cifs_sb;
struct cifs_tcon *tcon;
struct TCP_Server_Info *server;
unsigned int xid;
char *cur_offset;
struct cifsFileInfo *open_file;
struct cifs_io_parms io_parms;
int buf_type = CIFS_NO_BUFFER;
__u32 pid;
xid = get_xid();
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
/* FIXME: set up handlers for larger reads and/or convert to async */
rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize);
if (file->private_data == NULL) {
rc = -EBADF;
free_xid(xid);
return rc;
}
open_file = file->private_data;
tcon = tlink_tcon(open_file->tlink);
server = tcon->ses->server;
if (!server->ops->sync_read) {
free_xid(xid);
return -ENOSYS;
}
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
pid = open_file->pid;
else
pid = current->tgid;
if ((file->f_flags & O_ACCMODE) == O_WRONLY)
cifs_dbg(FYI, "attempting read on write only file instance\n");
for (total_read = 0, cur_offset = read_data; read_size > total_read;
total_read += bytes_read, cur_offset += bytes_read) {
current_read_size = min_t(uint, read_size - total_read, rsize);
/*
* For windows me and 9x we do not want to request more than it
* negotiated since it will refuse the read then.
*/
if ((tcon->ses) && !(tcon->ses->capabilities &
tcon->ses->server->vals->cap_large_files)) {
current_read_size = min_t(uint, current_read_size,
CIFSMaxBufSize);
}
rc = -EAGAIN;
while (rc == -EAGAIN) {
if (open_file->invalidHandle) {
rc = cifs_reopen_file(open_file, true);
if (rc != 0)
break;
}
io_parms.pid = pid;
io_parms.tcon = tcon;
io_parms.offset = *offset;
io_parms.length = current_read_size;
rc = server->ops->sync_read(xid, open_file, &io_parms,
&bytes_read, &cur_offset,
&buf_type);
}
if (rc || (bytes_read == 0)) {
if (total_read) {
break;
} else {
free_xid(xid);
return rc;
}
} else {
cifs_stats_bytes_read(tcon, total_read);
*offset += bytes_read;
}
}
free_xid(xid);
return total_read;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
linux
|
5d81de8e8667da7135d3a32a964087c0faf5483f
| 183,613,798,097,962,900,000,000,000,000,000,000,000 | 87 |
cifs: ensure that uncached writes handle unmapped areas correctly
It's possible for userland to pass down an iovec via writev() that has a
bogus user pointer in it. If that happens and we're doing an uncached
write, then we can end up getting less bytes than we expect from the
call to iov_iter_copy_from_user. This is CVE-2014-0069
cifs_iovec_write isn't set up to handle that situation however. It'll
blindly keep chugging through the page array and not filling those pages
with anything useful. Worse yet, we'll later end up with a negative
number in wdata->tailsz, which will confuse the sending routines and
cause an oops at the very least.
Fix this by having the copy phase of cifs_iovec_write stop copying data
in this situation and send the last write as a short one. At the same
time, we want to avoid sending a zero-length write to the server, so
break out of the loop and set rc to -EFAULT if that happens. This also
allows us to handle the case where no address in the iovec is valid.
[Note: Marking this for stable on v3.4+ kernels, but kernels as old as
v2.6.38 may have a similar problem and may need similar fix]
Cc: <[email protected]> # v3.4+
Reviewed-by: Pavel Shilovsky <[email protected]>
Reported-by: Al Viro <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
Signed-off-by: Steve French <[email protected]>
|
R_API void r_cmd_parsed_args_free(RCmdParsedArgs *a) {
if (!a) {
return;
}
int i;
for (i = 0; i < a->argc; i++) {
free (a->argv[i]);
}
free (a->argv);
free (a);
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
radare2
|
0052500c1ed5bf8263b26b9fd7773dbdc6f170c4
| 329,987,707,844,998,660,000,000,000,000,000,000,000 | 12 |
Fix heap OOB read in macho.iterate_chained_fixups ##crash
* Reported by peacock-doris via huntr.dev
* Reproducer 'tests_65305'
mrmacete:
* Return early if segs_count is 0
* Initialize segs_count also for reconstructed fixups
Co-authored-by: pancake <[email protected]>
Co-authored-by: Francesco Tamagni <[email protected]>
|
Subsets and Splits
CWE 416 & 19
The query filters records related to specific CWEs (Common Weakness Enumerations), providing a basic overview of entries with these vulnerabilities but without deeper analysis.
CWE Frequency in Train Set
Counts the occurrences of each CWE (Common Weakness Enumeration) in the dataset, providing a basic distribution but limited insight.