idx
int64 0
522k
| project
stringclasses 631
values | commit_id
stringlengths 7
40
| project_url
stringclasses 630
values | commit_url
stringlengths 4
164
| commit_message
stringlengths 0
11.5k
| target
int64 0
1
| func
stringlengths 5
484k
| func_hash
float64 1,559,120,642,045,605,000,000,000B
340,279,892,905,069,500,000,000,000,000B
| file_name
stringlengths 4
45
| file_hash
float64 25,942,829,220,065,710,000,000,000B
340,272,304,251,680,200,000,000,000,000B
⌀ | cwe
sequencelengths 0
1
| cve
stringlengths 4
16
| cve_desc
stringlengths 0
2.3k
| nvd_url
stringlengths 37
49
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
520,816 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_FSUnregister(Jsi_Filesystem *fsPtr) {
FSList *fsl = jsiFSList, *flast = NULL;
while (fsl) {
if (fsl->fsPtr == fsPtr) {
if (flast)
flast->next = fsl->next;
else
jsiFSList = fsl->next;
Jsi_Free(fsl);
break;
}
flast = fsl;
fsl = fsl->next;
}
return JSI_OK;
} | 80,723,876,479,438,970,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,817 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_ValueToBitset(Jsi_Interp *interp, Jsi_OptionSpec* spec, Jsi_Value *inValue, const char *inStr, void *record, Jsi_Wide flags)
{
// TODO: change this to not use byte instead of int...
int i, argc, n;
char *s =(((char*)record) + spec->offset);
char **argv;
const char *cp, **list = (const char**)spec->data;
uint64_t m = 0, im = 0;
int fflags = ((flags|spec->flags)&JSI_OPT_CUST_NOCASE?JSI_CMP_NOCASE:0);
if (!list)
return Jsi_LogError("custom enum spec did not set data: %s", spec->name);
switch (spec->size) {
case 1: im = *(uint8_t*)s; break;
case 2: im = *(uint16_t*)s; break;
case 4: im = *(uint32_t*)s; break;
case 8: im = *(uint64_t*)s; break;
default:
return Jsi_LogError("bitset size must be 1, 2, 4, or 8: %s", spec->name);
}
#ifndef JSI_LITE_ONLY
if (!inStr && Jsi_ValueIsString(interp, inValue))
inStr = Jsi_ValueString(interp, inValue, NULL);
#endif
if (inStr) {
if (*inStr == '+') {
inStr++;
m = im;
}
if (*inStr) {
Jsi_DString sStr;
Jsi_DSInit(&sStr);
Jsi_SplitStr(inStr, &argc, &argv, ",", &sStr);
for (i=0; i<argc; i++) {
int isnot = 0;
cp = argv[i];
if (*cp == '!') { isnot = 1; cp++; }
if (JSI_OK != Jsi_GetIndex(interp, cp, list, "enum", fflags, &n))
return JSI_ERROR;
if (n >= (int)(spec->size*8))
return Jsi_LogError("list larger than field size: %s", spec->name);
if (isnot)
m &= ~(1<<n);
else
m |= (1<<n);
}
Jsi_DSFree(&sStr);
}
} else {
#ifndef JSI_LITE_ONLY
if (!inValue) {
*s = 0;
return JSI_OK;
}
if (Jsi_ValueIsObjType(interp, inValue, JSI_OT_OBJECT) && !Jsi_ValueIsArray(interp, inValue)) {
Jsi_TreeEntry *tPtr;
Jsi_TreeSearch search;
Jsi_Tree *tp = Jsi_TreeFromValue(interp, inValue);
m = im;
for (tPtr = (tp?Jsi_TreeSearchFirst(tp, &search, 0, NULL):NULL);
tPtr != NULL; tPtr = Jsi_TreeSearchNext(&search)) {
cp =(char*) Jsi_TreeKeyGet(tPtr);
Jsi_Value *optval = (Jsi_Value*)Jsi_TreeValueGet(tPtr);
if (JSI_OK != Jsi_GetIndex(interp, cp, list, "bitset", fflags, &n)) {
Jsi_TreeSearchDone(&search);
return JSI_ERROR;
}
if (!Jsi_ValueIsBoolean(interp, optval)) {
Jsi_TreeSearchDone(&search);
return Jsi_LogError("object member is not a bool: %s", cp);
}
bool vb;
Jsi_ValueGetBoolean(interp, optval, &vb);
if (!vb)
m &= ~(1<<n);
else
m |= (1<<n);
}
if (tp)
Jsi_TreeSearchDone(&search);
*s = m;
return JSI_OK;
}
if (!Jsi_ValueIsArray(interp, inValue))
return Jsi_LogError("expected array or object");
argc = Jsi_ValueGetLength(interp, inValue);
for (i=0; i<argc; i++) {
int isnot = 0;
Jsi_Value *v = Jsi_ValueArrayIndex(interp, inValue, i);
const char *cp = (v?Jsi_ValueString(interp, v, NULL):"");
if (!cp)
return Jsi_LogError("expected string");
if (i == 0) {
if (*cp == '+' && !cp[1]) {
m = im;
continue;
}
}
if (*cp == '!') { isnot = 1; cp++; }
if (JSI_OK != Jsi_GetIndex(interp, cp, list, "bitset", fflags, &n))
return JSI_ERROR;
if (isnot)
m &= ~(1<<n);
else
m |= (1<<n);
}
*s = m;
#endif
}
switch (spec->size) {
case 1: *(uint8_t*)s = (uint8_t)m; break;
case 2: *(uint16_t*)s = (uint16_t)m; break;
case 4: *(uint32_t*)s = (uint32_t)m; break;
case 8: *(uint64_t*)s = (uint64_t)m; break;
}
return JSI_OK;
} | 195,635,772,770,759,900,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,818 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC SqliteConstructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_RC rc = JSI_ERROR;
/* void *cd = clientData; */
int flags;
char *zErrMsg;
const char *zFile = NULL, *vfs = 0;
/* In normal use, each JSI interpreter runs in a single thread. So
** by default, we can turn of mutexing on SQLite database connections.
** However, for testing purposes it is useful to have mutexes turned
** on. So, by default, mutexes default off. But if compiled with
** SQLITE_JSI_DEFAULT_FULLMUTEX then mutexes default on.
*/
flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
#ifdef SQLITE_JSI_DEFAULT_FULLMUTEX
flags |= SQLITE_OPEN_FULLMUTEX;
#else
flags |= SQLITE_OPEN_NOMUTEX;
#endif
Jsi_Value *vFile = Jsi_ValueArrayIndex(interp, args, 0);
Jsi_Value *arg = Jsi_ValueArrayIndex(interp, args, 1);
Jsi_DString dStr = {};
int ismem = 0, create = 0;
Jsi_Obj *fobj;
Jsi_Value *toacc;
const char *vf;
const char *dbname = NULL;
if (vFile==NULL || Jsi_ValueIsNull(interp, vFile) ||
((vf = Jsi_ValueString(interp, vFile, NULL)) && !Jsi_Strcmp(vf,":memory:"))) {
zFile = ":memory:";
ismem = 1;
} else {
zFile = Jsi_ValueNormalPath(interp, vFile, &dStr);
if (zFile == NULL)
return Jsi_LogError("bad or missing file name");
Jsi_StatBuf st = {};
st.st_uid = -1;
create = (Jsi_Lstat(interp, vFile, &st) != 0);
}
zErrMsg = 0;
Jsi_Db *db = (Jsi_Db*)Jsi_Calloc(1, sizeof(*db) );
if( db==0 ) {
Jsi_DSFree(&dStr);
Jsi_LogError("malloc failed");
return JSI_ERROR;
}
db->sig = SQLITE_SIG_DB;
db->_ = &dbObjCmd;
db->_->newCnt++;
db->_->activeCnt++;
db->stmtCacheMax = NUM_PREPARED_STMTS;
db->hasOpts = 1;
if ((arg != NULL && !Jsi_ValueIsNull(interp,arg))
&& Jsi_OptionsProcess(interp, SqlOptions, db, arg, 0) < 0) {
rc = JSI_ERROR;
goto bail;
}
if (ismem == 0 &&
(Jsi_InterpAccess(interp, vFile, (db->readonly ? JSI_INTACCESS_READ : JSI_INTACCESS_WRITE)) != JSI_OK
|| (create && Jsi_InterpAccess(interp, vFile, JSI_INTACCESS_CREATE) != JSI_OK))) {
Jsi_LogError("Safe accces denied");
goto bail;
}
if (db->stmtCacheMax<0 || db->stmtCacheMax>MAX_PREPARED_STMTS) {
Jsi_LogError("option stmtCacheMax value %d is not in range 0..%d", db->stmtCacheMax, MAX_PREPARED_STMTS);
goto bail;
}
if (!db->udata) {
db->udata = Jsi_ValueNewObj(interp, NULL);
Jsi_IncrRefCount(interp, db->udata);
}
if (db->readonly) {
flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
flags |= SQLITE_OPEN_READONLY;
} else {
flags &= ~SQLITE_OPEN_READONLY;
flags |= SQLITE_OPEN_READWRITE;
if (db->noCreate) {
flags &= ~SQLITE_OPEN_CREATE;
}
}
if (db->vfs)
vfs = Jsi_ValueToString(interp, db->vfs, NULL);
if(db->mutex == MUTEX_NONE) {
flags |= SQLITE_OPEN_NOMUTEX;
flags &= ~SQLITE_OPEN_FULLMUTEX;
} else {
flags &= ~SQLITE_OPEN_NOMUTEX;
}
if(db->mutex ==MUTEX_FULL) {
flags |= SQLITE_OPEN_FULLMUTEX;
flags &= ~SQLITE_OPEN_NOMUTEX;
} else {
flags &= ~SQLITE_OPEN_FULLMUTEX;
}
if (SQLITE_OK != sqlite3_open_v2(zFile, &db->db, flags, vfs)) {
Jsi_LogError("db open failed: %s", zFile);
goto bail;
}
//Jsi_DSFree(&translatedFilename);
if( SQLITE_OK!=sqlite3_errcode(db->db) ) {
zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(db->db));
DbClose(db->db);
db->db = 0;
}
if( db->db==0 ) {
sqlite3_free(zErrMsg);
goto bail;
}
;
toacc = NULL;
if (Jsi_FunctionIsConstructor(funcPtr)) {
toacc = _this;
} else {
Jsi_Obj *o = Jsi_ObjNew(interp);
Jsi_PrototypeObjSet(interp, "Sqlite", o);
Jsi_ValueMakeObject(interp, ret, o);
toacc = *ret;
}
sqlite3_create_function(db->db, "unixtime", -1, SQLITE_UTF8, db, jsiSqlFuncUnixTime, 0, 0);
fobj = Jsi_ValueGetObj(interp, toacc /* constructor obj*/);
if ((db->objId = Jsi_UserObjNew(interp, &sqliteobject, fobj, db))<0)
goto bail;
db->stmtHash = Jsi_HashNew(interp, JSI_KEYS_STRING, NULL);
db->fobj = fobj;
//dbSys->cnt = Jsi_UserObjCreate(interp, sqliteobject.name /*dbSys*/, fobj, db);
db->interp = interp;
db->optPtr = &db->queryOpts;
db->stmtCache = Jsi_ListNew((Jsi_Interp*)db, 0, dbStmtFreeProc);
rc = JSI_OK;
dbname = Jsi_DSValue(&db->name);
if (dbname[0])
sqlite3_db_config(db->db, SQLITE_DBCONFIG_MAINDBNAME, dbname);
Jsi_JSONParseFmt(interp, &db->version, "{libVer:\"%s\", hdrVer:\"%s\", hdrNum:%d, hdrSrcId:\"%s\", pkgVer:%d}",
(char *)sqlite3_libversion(), SQLITE_VERSION, SQLITE_VERSION_NUMBER, SQLITE_SOURCE_ID, jsi_DbPkgVersion);
dbSetupCallbacks(db, NULL);
bail:
if (rc != JSI_OK) {
if (db->hasOpts)
Jsi_OptionsFree(interp, SqlOptions, db, 0);
db->_->activeCnt--;
Jsi_Free(db);
}
Jsi_DSFree(&dStr);
Jsi_ValueMakeUndef(interp, ret);
return rc;
} | 328,822,905,687,274,100,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,819 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_Scandir(Jsi_Interp *interp, Jsi_Value* path, Jsi_Dirent ***namelist,
int (*filter)(const Jsi_Dirent *), int (*compar)(const Jsi_Dirent **, const Jsi_Dirent**))
{
void *data;
Jsi_Filesystem *fsPtr = Jsi_FilesystemForPath(interp, path, &data);
if (fsPtr == NULL || !fsPtr->scandirProc) return -1;
return fsPtr->scandirProc(interp, path, namelist, filter, compar);
} | 98,927,031,629,546,230,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,820 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | char* Jsi_NormalPath(Jsi_Interp *interp, const char *path, Jsi_DString *dStr) {
char prefix[3] = "";
char cdbuf[PATH_MAX];
Jsi_DSInit(dStr);
if (!path || !path[0]) return NULL;
if (*path == '/')
Jsi_DSAppend(dStr, path, NULL);
#ifdef __WIN32 /* TODO: add proper handling for windows paths. */
else if (*path && path[1] == ':') {
Jsi_DSAppend(dStr, path, NULL);
return Jsi_DSValue(dStr);
}
#endif
else if (path[0] == '~') {
Jsi_DSAppend(dStr, jsi_GetHomeDir(interp), (path[1] == '/' ? "" : "/"), path+1, NULL);
} else if (path[0] == '.' && path[1] == 0) {
if (jsiIntData.pwd) {
Jsi_DSAppend(dStr, jsiIntData.pwd, NULL);
} else {
Jsi_DSAppend(dStr, getcwd(cdbuf, sizeof(cdbuf)), NULL);
}
} else {
if (jsiIntData.pwd) {
Jsi_DSAppend(dStr, jsiIntData.pwd, "/", path, NULL);
} else {
Jsi_DSAppend(dStr, getcwd(cdbuf, sizeof(cdbuf)), "/", path, NULL);
}
}
Jsi_DString sStr = {};
char *cp = Jsi_DSValue(dStr);
#ifdef __WIN32
if (*cp && cp[1] == ':') {
prefix[0] = *cp;
prefix[1] = cp[1];
prefix[2] = 0;
cp += 2;
}
#endif
int i=0, n=0, m, nmax, unclean=0, slens[PATH_MAX];
char *sp = cp, *ss;
char *sptrs[PATH_MAX];
while (*cp && n<PATH_MAX) {
while (*cp && *cp == '/') {
cp++;
if (*cp == '/')
unclean = 1;
}
sptrs[n] = cp;
if (cp[0] == '.' && (cp[1] == '.' || cp[1] == '/'))
unclean = 1;
ss = cp++;
while (*ss && *ss != '/')
ss++;
slens[n++] = (ss-cp) + 1;
cp = ss;
}
if (!unclean)
return sp;
/* Need to remove //, /./, /../ */
nmax = n--;
while (n>0) {
if (slens[n]<=0) {
n--;
continue;
}
if (Jsi_Strncmp(sptrs[n],".",slens[n])==0)
slens[n] = 0;
else if (Jsi_Strncmp(ss,"..",slens[n])==0) {
int cnt = 0;
m = n-1;
while (m>=0 && cnt<1) {
if (slens[m])
cnt++;
slens[m] = 0;
m--;
}
if (cnt<1)
return sp; /* Can't fix it */
}
n--;
}
/* TODO: prefix for windows. */
Jsi_DSAppend(&sStr, prefix, NULL);
for (i=0; i<nmax; i++) {
if (slens[i]) {
#ifdef __WIN32
Jsi_DSAppend(&sStr, "/" /*"\\"*/, NULL);
#else
Jsi_DSAppend(&sStr, "/", NULL);
#endif
Jsi_DSAppendLen(&sStr, sptrs[i], slens[i]);
}
}
Jsi_DSSetLength(dStr, 0);
Jsi_DSAppend(dStr, Jsi_DSValue(&sStr), NULL);
Jsi_DSFree(&sStr);
return Jsi_DSValue(dStr);
} | 4,524,698,911,385,806,500,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,821 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void Jsi_TreeSearchDone(Jsi_TreeSearch *searchPtr)
{
if (searchPtr->Ptrs != searchPtr->staticPtrs)
Jsi_Free(searchPtr->Ptrs);
searchPtr->Ptrs = searchPtr->staticPtrs;
searchPtr->top = 0;
} | 152,258,907,704,951,750,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,822 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | bool Jsi_NumberIsNormal(Jsi_Number a) { return (fpclassify(a) == FP_ZERO || isnormal(a)); } | 185,520,048,852,753,400,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,823 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_AliasFree(Jsi_Interp *interp, Jsi_HashEntry *hPtr, void *data) {
/* TODO: deal with other copies of func may be floating around (refCount). */
AliasCmd *ac = (AliasCmd *)data;
if (!ac) return JSI_ERROR;
SIGASSERT(ac,ALIASCMD);
if (ac->func)
Jsi_DecrRefCount(ac->dinterp, ac->func);
if (ac->args)
Jsi_DecrRefCount(ac->dinterp, ac->args);
if (!ac->cmdVal)
return JSI_OK;
Jsi_Func *fobj = ac->cmdVal->d.obj->d.fobj->func;
fobj->cmdSpec->reserved[2] = NULL;
fobj->cmdSpec->proc = NULL;
if (ac->intobj && ac->intobj->subinterp) {
Jsi_CommandDelete(ac->intobj->subinterp, ac->cmdName);
//if (Jsi_Strchr(ac->cmdName, '.'))
// Jsi_LogBug("alias free with X.Y dot name leaks memory: %s", ac->cmdName);
} else
Jsi_DecrRefCount(ac->subinterp, ac->cmdVal);
_JSI_MEMCLEAR(ac);
Jsi_Free(ac);
return JSI_OK;
} | 218,799,581,343,029,660,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,824 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | const char* jsi_opcode_string(uint opCode)
{
if (opCode >= (sizeof(jsi_op_names)/sizeof(jsi_op_names[0])))
return "NULL";
return jsi_op_names[opCode];
} | 270,775,758,774,835,640,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,825 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_Access(Jsi_Interp *interp, Jsi_Value* path, int mode) {
void *data;
Jsi_Filesystem *fsPtr = Jsi_FilesystemForPath(interp, path, &data);
if (fsPtr == NULL || !fsPtr->accessProc) return -1;
if (interp->isSafe && fsPtr && fsPtr == &jsiFilesystem) {
int aflag = (mode&W_OK ? JSI_INTACCESS_WRITE : JSI_INTACCESS_READ);
if (Jsi_InterpAccess(interp, path, aflag) != JSI_OK)
return -1;
}
return fsPtr->accessProc(interp, path, mode);
} | 186,867,692,718,159,160,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,826 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_jfalse(int off) { JSI_NEW_CODES(0,OP_JFALSE, off); } | 219,065,136,698,585,260,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,827 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_ret(jsi_Pstate *p, jsi_Pline *line, int n) { JSI_NEW_CODESLN(0,OP_RET, n); } | 66,046,521,816,693,670,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,828 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | char *Jsi_ValueArrayIndexToStr(Jsi_Interp *interp, Jsi_Value *args, int index, int *lenPtr)
{
Jsi_Value *arg = Jsi_ValueArrayIndex(interp, args, index);
if (!arg)
return NULL;
char *res = Jsi_ValueString(interp, arg, lenPtr);
if (res)
return res;
res = (char*)Jsi_ValueToString(interp, arg, NULL);
if (res && lenPtr)
*lenPtr = Jsi_Strlen(res);
return res;
} | 218,128,720,555,327,700,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,829 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Db* Jsi_DbNew(const char *zFile, int inFlags /* JSI_DBI_* */)
{
if (!jsi_dbVfsPtr) {
printf( "Sqlite unsupported\n");
return NULL;
}
return jsi_dbVfsPtr->dbNew(zFile, inFlags);
} | 710,917,260,666,666,500,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,830 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsiInterpDelete(Jsi_Interp* interp, void *unused)
{
SIGASSERT(interp,INTERP);
bool isMainInt = (interp == jsiIntData.mainInterp);
int mainFlag = (isMainInt ? 2 : 1);
if (isMainInt)
DeleteAllInterps();
if (interp->opts.initProc)
(*interp->opts.initProc)(interp, mainFlag);
jsiIntData.delInterp = interp;
if (interp->gsc) jsi_ScopeChainFree(interp, interp->gsc);
if (interp->csc) Jsi_DecrRefCount(interp, interp->csc);
if (interp->ps) jsi_PstateFree(interp->ps);
int i;
for (i=0; i<interp->maxStack; i++) {
if (interp->Stack[i]) Jsi_DecrRefCount(interp, interp->Stack[i]);
if (interp->Obj_this[i]) Jsi_DecrRefCount(interp, interp->Obj_this[i]);
}
if (interp->Stack) {
Jsi_Free(interp->Stack);
Jsi_Free(interp->Obj_this);
}
if (interp->argv0)
Jsi_DecrRefCount(interp, interp->argv0);
if (interp->console)
Jsi_DecrRefCount(interp, interp->console);
if (interp->lastSubscriptFail)
Jsi_DecrRefCount(interp, interp->lastSubscriptFail);
if (interp->nullFuncRet)
Jsi_DecrRefCount(interp, interp->nullFuncRet);
Jsi_HashDelete(interp->codeTbl);
Jsi_MapDelete(interp->cmdSpecTbl);
Jsi_HashDelete(interp->fileTbl);
Jsi_HashDelete(interp->funcObjTbl);
Jsi_HashDelete(interp->funcsTbl);
if (interp->profileCnt) { // TODO: resolve some values from dbPtr, others not.
double endTime = jsi_GetTimestamp();
double coverage = (int)(100.0*interp->coverHit/interp->coverAll);
Jsi_DString dStr;
Jsi_DSInit(&dStr);
Jsi_DSPrintf(&dStr, "PROFILE: TOTAL: time=%.6f, func=%.6f, cmd=%.6f, #funcs=%d, #cmds=%d, cover=%2.1f%%, #values=%d, #objs=%d %s%s\n",
endTime-interp->startTime, interp->funcSelfTime, interp->cmdSelfTime, interp->funcCallCnt, interp->cmdCallCnt,
coverage, interp->dbPtr->valueAllocCnt, interp->dbPtr->objAllocCnt,
interp->parent?" ::":"", (interp->parent&&interp->name?interp->name:""));
Jsi_Puts(interp, jsi_Stderr, Jsi_DSValue(&dStr), -1);
Jsi_DSFree(&dStr);
}
if (isMainInt)
Jsi_HashDelete(interp->lexkeyTbl);
Jsi_HashDelete(interp->protoTbl);
if (interp->subthread)
jsiIntData.mainInterp->threadCnt--;
if (interp->subthread && interp->strKeyTbl == jsiIntData.mainInterp->strKeyTbl)
jsiIntData.mainInterp->threadShrCnt--;
if (!jsiIntData.mainInterp->threadShrCnt)
#ifdef JSI_USE_MANY_STRKEY
jsiIntData.mainInterp->strKeyTbl->v.tree->opts.lockTreeProc = NULL;
#else
jsiIntData.mainInterp->strKeyTbl->v.hash->opts.lockHashProc = NULL;
#endif
//Jsi_ValueMakeUndef(interp, &interp->ret);
Jsi_HashDelete(interp->thisTbl);
Jsi_HashDelete(interp->varTbl);
Jsi_HashDelete(interp->genValueTbl);
Jsi_HashDelete(interp->genObjTbl);
Jsi_HashDelete(interp->aliasHash);
if (interp->staticFuncsTbl)
Jsi_HashDelete(interp->staticFuncsTbl);
if (interp->breakpointHash)
Jsi_HashDelete(interp->breakpointHash);
if (interp->preserveTbl->numEntries!=0)
Jsi_LogBug("Preserves unbalanced");
Jsi_HashDelete(interp->preserveTbl);
if (interp->curDir)
Jsi_Free(interp->curDir);
if (isMainInt) {
jsi_InitFilesys(interp, mainFlag);
}
#ifndef JSI_OMIT_VFS
jsi_InitVfs(interp, 1);
#endif
#ifndef JSI_OMIT_CDATA
jsi_InitCData(interp, mainFlag);
#endif
#if JSI__MYSQL==1
Jsi_InitMySql(interp, mainFlag);
#endif
while (interp->interpStrEvents) {
InterpStrEvent *se = interp->interpStrEvents;
interp->interpStrEvents = se->next;
if (se->acfunc)
Jsi_DecrRefCount(interp, se->acfunc);
if (se->acdata)
Jsi_Free(se->acdata);
Jsi_Free(se);
}
if (interp->Mutex)
Jsi_MutexDelete(interp, interp->Mutex);
if (interp->QMutex) {
Jsi_MutexDelete(interp, interp->QMutex);
Jsi_DSFree(&interp->interpEvalQ);
}
if (interp->nullFuncArg)
Jsi_DecrRefCount(interp, interp->nullFuncArg);
if (interp->NullValue)
Jsi_DecrRefCount(interp, interp->NullValue);
if (interp->Function_prototype_prototype) {
if (interp->Function_prototype_prototype->refCnt>1)
Jsi_DecrRefCount(interp, interp->Function_prototype_prototype);
Jsi_DecrRefCount(interp, interp->Function_prototype_prototype);
}
if (interp->Object_prototype) {
Jsi_DecrRefCount(interp, interp->Object_prototype);
}
Jsi_HashDelete(interp->regexpTbl);
Jsi_OptionsFree(interp, InterpOptions, interp, 0);
Jsi_HashDelete(interp->userdataTbl);
Jsi_HashDelete(interp->eventTbl);
if (interp->inopts)
Jsi_DecrRefCount(interp, interp->inopts);
if (interp->safeWriteDirs)
Jsi_DecrRefCount(interp, interp->safeWriteDirs);
if (interp->safeReadDirs)
Jsi_DecrRefCount(interp, interp->safeReadDirs);
if (interp->pkgDirs)
Jsi_DecrRefCount(interp, interp->pkgDirs);
for (i=0; interp->cleanObjs[i]; i++) {
interp->cleanObjs[i]->tree->opts.freeHashProc = 0;
Jsi_ObjFree(interp, interp->cleanObjs[i]);
}
Jsi_HashDelete(interp->bindTbl);
for (i = 0; i <= interp->cur_scope; i++)
jsi_ScopeStrsFree(interp, interp->scopes[i]);
#if JSI__ZVFS==1
Jsi_InitZvfs(interp, mainFlag);
#endif
if (!interp->parent)
Jsi_HashDelete(interp->loadTbl);
if (interp->packageHash)
Jsi_HashDelete(interp->packageHash);
Jsi_HashDelete(interp->assocTbl);
interp->cleanup = 1;
jsi_AllObjOp(interp, NULL, -1);
#ifdef JSI_MEM_DEBUG
jsi_DebugDumpValues(interp);
#endif
if (isMainInt || interp->strKeyTbl != jsiIntData.mainInterp->strKeyTbl)
Jsi_MapDelete(interp->strKeyTbl);
if (isMainInt)
jsiIntData.mainInterp = NULL;
_JSI_MEMCLEAR(interp);
jsiIntData.delInterp = NULL;
Jsi_Free(interp);
return JSI_OK;
} | 86,529,672,574,519,680,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,831 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC SqliteBackupCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_Db *jdb;
Jsi_RC rv = JSI_OK;
int rc;
const char *zDestFile;
const char *zSrcDb;
sqlite3 *pDest;
sqlite3_backup *pBackup;
if (!(jdb = dbGetDbHandle(interp, _this, funcPtr))) return JSI_ERROR;
Jsi_Value *vFile = Jsi_ValueArrayIndex(interp, args, 0);
int argc = Jsi_ValueGetLength(interp, args);
if( argc==1 ) {
zSrcDb = "main";
} else {
zSrcDb = Jsi_ValueArrayIndexToStr(interp, args, 1, NULL);
}
Jsi_DString dStr = {};
if (!vFile)
zDestFile = ":memory:";
else {
zDestFile = Jsi_ValueNormalPath(interp, vFile, &dStr);
if (zDestFile == NULL)
return Jsi_LogError("bad or missing file name");
}
rc = sqlite3_open(zDestFile, &pDest);
if( rc!=SQLITE_OK ) {
Jsi_LogError("cannot open target database %s: %s", zDestFile, sqlite3_errmsg(pDest));
DbClose(pDest);
Jsi_DSFree(&dStr);
return JSI_ERROR;
}
pBackup = sqlite3_backup_init(pDest, "main", jdb->db, zSrcDb);
if( pBackup==0 ) {
Jsi_LogError("backup failed: %s", sqlite3_errmsg(pDest));
DbClose(pDest);
Jsi_DSFree(&dStr);
return JSI_ERROR;
}
while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ) {}
sqlite3_backup_finish(pBackup);
if( rc==SQLITE_DONE ) {
rv = JSI_OK;
} else {
Jsi_LogError("backup failed: %s", sqlite3_errmsg(pDest));
rv = JSI_ERROR;
}
Jsi_DSFree(&dStr);
DbClose(pDest);
return rv;
} | 45,298,365,520,330,980,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,832 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_wsFileRead(Jsi_Interp *interp, Jsi_Value *name, Jsi_DString *dStr, jsi_wsCmdObj *cmdPtr, jsi_wsPss *pss) {
Jsi_StatBuf sb;
Jsi_RC rc = JSI_ERROR;
int n = Jsi_Stat(interp, name, &sb);
if (!n && sb.st_size>0) {
char fdir[PATH_MAX];
const char* cr = cmdPtr->curRoot, *fpath=NULL;
if (!Jsi_FSNative(interp, name) || ((fpath= Jsi_Realpath(interp, name, fdir))
&& cr && !Jsi_Strncmp(fpath, cr, Jsi_Strlen(cr)))) {
rc = Jsi_FileRead(interp, name, dStr);
if (rc == JSI_OK && cmdPtr->onModify && Jsi_FSNative(interp, name))
jsi_wsFileAdd(interp, cmdPtr, name);
} else
fprintf(stderr, "Skip read file %s in %s\n", Jsi_ValueString(interp, name, NULL), (cr?cr:""));
}
if (cmdPtr->noWarn)
return JSI_OK;
return rc;
} | 134,515,354,387,194,060,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,833 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_not() { JSI_NEW_CODES(0,OP_NOT, 0); } | 153,728,191,345,898,490,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,834 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Value* Jsi_ValueMakeBlob(Jsi_Interp *interp, Jsi_Value **vPtr, unsigned char *s, int len) {
Jsi_Value *v = (vPtr?*vPtr:NULL);
if (!v)
v = Jsi_ValueNew(interp);
else
Jsi_ValueReset(interp, vPtr);
Jsi_Obj *obj = Jsi_ObjNewType(interp, JSI_OT_STRING);
Jsi_ValueMakeObject(interp, &v, obj);
obj->d.s.str = (char*)s;
obj->d.s.len = len;
obj->isBlob = 1;
return v;
} | 51,532,919,170,752,640,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,835 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void dbOutputQuotedString(Jsi_DString *dStr, const char *z) {
int i;
int nSingle = 0;
for(i=0; z[i]; i++) {
if( z[i]=='\'' ) nSingle++;
}
if( nSingle==0 ) {
Jsi_DSAppend(dStr,"'", z, "'", NULL);
} else {
Jsi_DSAppend(dStr,"'", NULL);
while( *z ) {
for(i=0; z[i] && z[i]!='\''; i++) {}
if( i==0 ) {
Jsi_DSAppend(dStr,"''", NULL);
z++;
} else if( z[i]=='\'' ) {
Jsi_DSAppendLen(dStr,z, i);
Jsi_DSAppend(dStr,"''", NULL);
z += i+1;
} else {
Jsi_DSAppend(dStr, z, NULL);
break;
}
}
Jsi_DSAppend(dStr,"'", NULL);
}
} | 242,145,618,564,523,600,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,836 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_TreeEntry* maximum_node(Jsi_TreeEntry* n) {
Assert (n != NULL);
while (n->right != NULL) {
n = n->right;
}
return n;
} | 102,096,612,285,266,430,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,837 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_AliasCreateCmd(Jsi_Interp* interp, const char* key, AliasCmd* ac) {
if (Jsi_InterpGone(interp))
return JSI_ERROR;
key = Jsi_KeyAdd(interp, key);
Jsi_Value *cmd = jsi_CommandCreate(interp, key, jsi_AliasInvoke, NULL, 0, 0);
if (!cmd)
return Jsi_LogBug("command create failure");
ac->cmdVal = cmd;
Jsi_Func *fobj = cmd->d.obj->d.fobj->func;
fobj->cmdSpec->reserved[2] = ac;
cmd->d.obj->isNoOp = (ac->func->d.obj->d.fobj->func->callback == jsi_NoOpCmd);
return JSI_OK;
} | 318,525,960,491,245,800,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,838 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_Rename(Jsi_Interp *interp, Jsi_Value *src, Jsi_Value *dst) {
void *data;
Jsi_Filesystem *fsPtr = Jsi_FilesystemForPath(interp, src, &data);
if (fsPtr != Jsi_FilesystemForPath(interp, src, &data)) return -1;
if (fsPtr == NULL || !fsPtr->renameProc) return -1;
return fsPtr->renameProc(interp, src,dst);
} | 209,467,734,178,921,730,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,839 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_Value* dbGetValueGet(Jsi_Interp *interp, sqlite3_value *pIn)
{
Jsi_Value *v = Jsi_ValueNew(interp);
switch (sqlite3_value_type(pIn)) {
case SQLITE_BLOB: {
int bytes;
bytes = sqlite3_value_bytes(pIn);
const char *zBlob = (char*) sqlite3_value_blob(pIn);
if(!zBlob ) {
return Jsi_ValueMakeNull(interp, &v);
}
unsigned char *uptr = (unsigned char*)Jsi_Malloc(bytes+1);
memcpy(uptr, zBlob, bytes);
uptr[bytes] = 0;
return Jsi_ValueMakeBlob(interp, &v, uptr, bytes);
}
case SQLITE_INTEGER: {
sqlite_int64 n = sqlite3_value_int64(pIn);
if( n>=-2147483647 && n<=2147483647 ) {
return Jsi_ValueMakeNumber(interp, &v, n);
} else {
return Jsi_ValueMakeNumber(interp, &v, n);
}
}
case SQLITE_FLOAT: {
return Jsi_ValueMakeNumber(interp, &v, (Jsi_Number)sqlite3_value_double(pIn));
}
case SQLITE_NULL: {
return Jsi_ValueMakeNull(interp, &v);
}
default:
return Jsi_ValueMakeStringDup(interp, &v, (char *)sqlite3_value_text(pIn));
}
return v;
} | 215,067,176,074,266,000,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,840 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC SqliteRestoreCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_Db *jdb;
const char *zSrcFile;
const char *zDestDb;
sqlite3 *pSrc;
sqlite3_backup *pBackup;
int nTimeout = 0;
int rc;
if (!(jdb = dbGetDbHandle(interp, _this, funcPtr))) return JSI_ERROR;
Jsi_Value *vFile = Jsi_ValueArrayIndex(interp, args, 0);
int argc = Jsi_ValueGetLength(interp, args);
if( argc==1 ) {
zDestDb = "main";
} else {
zDestDb = Jsi_ValueArrayIndexToStr(interp, args, 1, NULL);
}
Jsi_DString dStr = {};
if (!vFile)
zSrcFile = ":memory:";
else {
zSrcFile = Jsi_ValueNormalPath(interp, vFile, &dStr);
if (zSrcFile == NULL)
return Jsi_LogError("bad or missing file name");
}
rc = sqlite3_open_v2(zSrcFile, &pSrc, SQLITE_OPEN_READONLY, 0);
if( rc!=SQLITE_OK ) {
Jsi_LogError("cannot open source database: %s", sqlite3_errmsg(pSrc));
DbClose(pSrc);
Jsi_DSFree(&dStr);
return JSI_ERROR;
}
pBackup = sqlite3_backup_init(jdb->db, zDestDb, pSrc, "main");
if( pBackup==0 ) {
Jsi_LogError("restore failed: %s", sqlite3_errmsg(jdb->db));
DbClose(pSrc);
Jsi_DSFree(&dStr);
return JSI_ERROR;
}
while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK
|| rc==SQLITE_BUSY ) {
if( rc==SQLITE_BUSY ) {
if( nTimeout++ >= 3 ) break;
sqlite3_sleep(100);
}
}
sqlite3_backup_finish(pBackup);
Jsi_RC rv;
if( rc==SQLITE_DONE ) {
rv = JSI_OK;
} else if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED ) {
Jsi_LogError("restore failed: source database busy");
rv = JSI_ERROR;
} else {
Jsi_LogError("restore failed: %s", sqlite3_errmsg(jdb->db));
rv = JSI_ERROR;
}
Jsi_DSFree(&dStr);
DbClose(pSrc);
return rv;
} | 64,242,374,379,968,130,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,841 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_HashEntryNew(Jsi_Hash *tablePtr, const void *key, bool *newPtr)
{
if (tablePtr->opts.lockHashProc && (*tablePtr->opts.lockHashProc)(tablePtr, 1) != JSI_OK)
return NULL;
Jsi_HashEntry *hPtr = (*((tablePtr)->createProc))(tablePtr, key, newPtr);
#ifdef JSI_HAS_SIG_HASHENTRY
SIGINIT(hPtr, HASHENTRY);
#endif
if (tablePtr->opts.lockHashProc)
(*tablePtr->opts.lockHashProc)(tablePtr, 0);
return hPtr;
} | 224,846,975,247,741,500,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,842 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_ValueInsert(Jsi_Interp *interp, Jsi_Value *target, const char *key, Jsi_Value *val, int flags)
{
if (target == NULL)
target = interp->csc;
if (target->vt != JSI_VT_OBJECT) {
if (interp->strict)
Jsi_LogWarn("Target is not object");
return JSI_ERROR;
}
target->f.flag |= flags;
if (Jsi_ObjInsert(interp, target->d.obj, key, val, flags))
return JSI_OK;
return JSI_ERROR;
} | 330,836,422,110,134,700,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,843 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Value* jsi_ValueMakeBlobDup(Jsi_Interp *interp, Jsi_Value **ret, unsigned char *s, int len) {
if (len<0) len = Jsi_Strlen((char*)s);
uchar *dp = (uchar*)Jsi_Malloc(len+1);
memcpy(dp, s, len);
dp[len] = 0;
return Jsi_ValueMakeBlob(interp, ret, dp, len);
} | 71,343,373,577,338,490,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,844 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void dbEvalRowInfo(
DbEvalContext *p, /* Evaluation context */
int *pnCol, /* OUT: Number of column names */
char ***papColName, /* OUT: Array of column names */
int **papColType
) {
/* Compute column names */
// Jsi_Interp *interp = p->jdb->interp;
if( 0==p->apColName ) {
sqlite3_stmt *pStmt = p->pPreStmt->pStmt;
uint i; /* Iterator variable */
uint nCol; /* Number of columns returned by pStmt */
char **apColName = 0; /* Array of column names */
int *apColType = 0;
const char *zColName; /* Column name */
int numRid = 0; /* Number of times rowid seen. */
p->nCol = nCol = sqlite3_column_count(pStmt);
if( nCol>0 && (papColName || p->pArray) ) {
uint cnLen = sizeof(char*)*nCol, cnStart = cnLen;
for(i=0; i<nCol && cnLen<sizeof(p->staticColNames); i++)
cnLen += Jsi_Strlen(sqlite3_column_name(pStmt,i))+1;
if (cnLen>=sizeof(p->staticColNames)) {
apColName = (char**)Jsi_Calloc(nCol, sizeof(char*) );
cnStart = 0;
} else {
apColName = (char**)p->staticColNames;
}
if (papColType) {
if (nCol < SQL_MAX_STATIC_TYPES)
apColType = p->staticColTypes;
else
apColType = (int*)Jsi_Calloc(nCol, sizeof(int));
}
for(i=0; i<nCol; i++) {
zColName = sqlite3_column_name(pStmt,i);
if (cnStart==0)
apColName[i] = Jsi_Strdup(zColName);
else {
apColName[i] = p->staticColNames+cnStart;
Jsi_Strcpy(apColName[i], zColName);
cnStart += Jsi_Strlen(zColName)+1;
}
if (apColType)
apColType[i] = sqlite3_column_type(pStmt,i);
/* Check if rowid appears first, and more than once. */
if ((i == 0 || numRid>0) &&
(zColName[0] == 'r' && Jsi_Strcmp(zColName,"rowid") == 0)) {
numRid++;
}
}
/* Change first rowid to oid. */
if (numRid > 1) {
if (apColName != (char**)p->staticColNames) {
Jsi_Free(apColName[0]);
apColName[0] = Jsi_Strdup("oid");
} else {
Jsi_Strcpy(apColName[0], "oid");
}
}
p->apColName = apColName;
p->apColType = apColType;
}
}
if( papColName ) {
*papColName = p->apColName;
}
if( papColType ) {
*papColType = p->apColType;
}
if( pnCol ) {
*pnCol = p->nCol;
}
} | 73,264,534,785,316,380,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,845 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_scatch(jsi_Pstate *p, jsi_Pline *line, const char *var) { JSI_NEW_CODESLN(0,OP_SCATCH, var); } | 124,937,028,650,948,280,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,846 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void Jsi_RegExpFree(Jsi_Regex* re) {
regfree(&re->reg);
_JSI_MEMCLEAR(re);
Jsi_Free(re);
} | 124,637,505,591,240,360,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,847 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_eval(jsi_Pstate *p, jsi_Pline *line, int argc, Jsi_OpCodes *c) {
jsi_FreeOpcodes(c); // Eliminate leak of unused opcodes.
JSI_NEW_CODESLN(0,OP_EVAL, argc);
} | 151,237,612,472,150,300,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,848 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_DecrRefCount(Jsi_Interp* interp, Jsi_Value *v) {
SIGASSERT(v,VALUE);
if (v->refCnt<=0) {
#ifdef JSI_MEM_DEBUG
fprintf(stderr, "Value decr with ref %d: VD.Idx=%d\n", v->refCnt, v->VD.Idx);
#endif
return -2;
}
int ref;
jsi_DebugValue(v,"Decr", jsi_DebugValueCallIdx(), interp);
if ((ref = --(v->refCnt)) <= 0) {
v->refCnt = -1;
Jsi_ValueFree(interp, v);
}
return ref;
} | 254,347,709,165,450,930,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,849 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void NormalizeUnixPath(Jsi_Interp *interp, char *path) {
char **argv; int argc, i;
if (!Jsi_Strstr(path, "./")) return;
Jsi_DString dStr = {}, eStr = {};
if (path[0] != '/' && Jsi_Strstr(path, "..")) {
char *npath = Jsi_GetCwd(interp, &eStr);
if (npath && Jsi_Strcmp(npath,"/")) {
Jsi_DSAppend(&eStr, "/", path, NULL);
path = Jsi_DSValue(&eStr);
}
}
Jsi_DString sStr;
Jsi_DSInit(&sStr);
Jsi_SplitStr(path, &argc, &argv, "/", &sStr);
char *cp = path;
*cp = 0;
for (i=0; i<argc; i++) {
if (i == 0 && argv[0][0] == 0) {
continue;
} else if (argv[i][0] == 0) {
continue;
} else if (i && !Jsi_Strcmp(argv[i],".")) {
continue;
} else if (!Jsi_Strcmp(argv[i],"..")) {
char *pcp = Jsi_DSValue(&dStr), *lcp = pcp;
pcp = Jsi_Strrchr(pcp, '/');
if (pcp && pcp != Jsi_DSValue(&dStr)) {
*pcp = 0;
Jsi_DSSetLength(&dStr, Jsi_Strlen(lcp));
}
continue;
} else {
Jsi_DSAppend(&dStr, (i>0?"/":""), argv[i], NULL);
}
}
Jsi_DSFree(&sStr);
Jsi_Strcpy(path, Jsi_DSValue(&dStr));
Jsi_DSFree(&dStr);
Jsi_DSFree(&eStr);
} | 146,308,528,084,068,800,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,850 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void dbTypeNameHashInit(Jsi_Db *jdb) {
Jsi_Interp *interp = jdb->interp;
Jsi_Hash *hPtr = jdb->typeNameHash = Jsi_HashNew(interp, JSI_KEYS_STRING, NULL);
Jsi_HashSet(hPtr, (void*)"blob", (void*)JSI_OPTION_STRBUF);
Jsi_HashSet(hPtr, (void*)"string", (void*)JSI_OPTION_STRING);
Jsi_HashSet(hPtr, (void*)"double", (void*)JSI_OPTION_DOUBLE);
Jsi_HashSet(hPtr, (void*)"integer", (void*)JSI_OPTION_INT64);
Jsi_HashSet(hPtr, (void*)"bool", (void*)JSI_OPTION_BOOL);
Jsi_HashSet(hPtr, (void*)"time_d", (void*)JSI_OPTION_TIME_D);
Jsi_HashSet(hPtr, (void*)"time_w", (void*)JSI_OPTION_TIME_W);
Jsi_HashSet(hPtr, (void*)"time_t", (void*)JSI_OPTION_TIME_T);
Jsi_HashSet(hPtr, (void*)"date", (void*)JSI_OPTION_TIME_W);
Jsi_HashSet(hPtr, (void*)"time", (void*)JSI_OPTION_TIME_W);
Jsi_HashSet(hPtr, (void*)"datetime", (void*)JSI_OPTION_TIME_W);
} | 168,891,833,501,740,860,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,851 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static int jsi_FSWriteProc(Jsi_Channel chan, const char *buf, int size) {
return fwrite(buf, 1, size, _JSI_GETFP(chan,0));
} | 37,911,761,756,014,330,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,852 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_unref() { JSI_NEW_CODES(0,OP_UNREF, 0); } | 278,720,852,800,359,400,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,853 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC FilesysWriteCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
int sum = 0, n, m;
UdfGet(udf, _this, funcPtr);
char *buf = Jsi_ValueArrayIndexToStr(interp, args, 0, &m);
if (!udf->filename) {
goto bail;
}
while (m > 0 && sum < MAX_LOOP_COUNT && (n = Jsi_Write(interp, udf->chan, buf, m)) > 0) {
/* TODO: limit max size. */
sum += n;
m -= n;
}
bail:
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)sum);
return JSI_OK;
} | 210,108,322,658,213,640,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,854 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static jsi_JmpPopInfo *jpinfo_new(int off, int topop)
{
jsi_JmpPopInfo *r = (jsi_JmpPopInfo *)Jsi_Calloc(1, sizeof(*r));
r->off = off;
r->topop = topop;
return r;
} | 163,845,800,481,626,500,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,966 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::SwitchInst* Decoder::transformToSwitch(
llvm::CallInst* pseudo,
llvm::Value* val,
llvm::BasicBlock* defaultBb,
const std::vector<llvm::BasicBlock*>& cases)
{
unsigned numCases = 0;
for (auto* c : cases)
{
if (c != defaultBb)
{
++numCases;
}
}
// If we do not do this, this can happen:
// "Instruction does not dominate all uses"
auto* insn = dyn_cast<Instruction>(val);
if (insn && insn->getType())
{
auto* gv = new GlobalVariable(
*insn->getModule(),
insn->getType(),
false,
GlobalValue::ExternalLinkage,
nullptr);
auto* s = new StoreInst(insn, gv);
s->insertAfter(insn);
val = new LoadInst(gv, "", pseudo);
}
auto* term = pseudo->getParent()->getTerminator();
assert(pseudo->getNextNode() == term);
auto* intType = cast<IntegerType>(val->getType());
auto* sw = SwitchInst::Create(val, defaultBb, numCases, term);
unsigned cntr = 0;
for (auto& c : cases)
{
if (c != defaultBb)
{
sw->addCase(ConstantInt::get(intType, cntr), c);
}
++cntr;
}
term->eraseFromParent();
return sw;
} | 339,697,549,952,328,130,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,967 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | bool Decoder::canSplitFunctionOn(llvm::BasicBlock* bb)
{
for (auto* u : bb->users())
{
// All users must be unconditional branch instructions.
//
auto* br = dyn_cast<BranchInst>(u);
if (br == nullptr || br->isConditional())
{
LOG << "\t\t\t\t\t\t" << "!CAN : user not uncond for "
<< llvmObjToString(u)
<< ", user = " << llvmObjToString(br) << std::endl;
return false;
}
// Branch can not come from istruction right before basic block.
// This expects that such branches were created
// TODO: if
//
AsmInstruction brAsm(br);
AsmInstruction bbAsm(bb);
if (brAsm.getEndAddress() == bbAsm.getAddress())
{
LOG << "\t\t\t\t\t\t" << "branch from ASM insn right before: "
<< brAsm.getAddress() << " -> " << bbAsm.getAddress()
<< std::endl;
return false;
}
// BB must be true branch in all users.
//
// if (br->getSuccessor(0) != bb)
// {
// return false;
// }
}
return true;
} | 172,558,044,285,921,060,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,968 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::Function* Decoder::splitFunctionOn(
utils::Address addr,
llvm::BasicBlock* splitOnBb)
{
LOG << "\t\t\t\t" << "S: splitFunctionOn @ " << addr << " on "
<< splitOnBb->getName().str() << std::endl;
if (splitOnBb->getPrevNode() == nullptr)
{
LOG << "\t\t\t\t" << "S: BB first @ " << addr << std::endl;
return splitOnBb->getParent();
}
std::set<BasicBlock*> newFncStarts;
if (!canSplitFunctionOn(addr, splitOnBb, newFncStarts))
{
LOG << "\t\t\t\t" << "S: !canSplitFunctionOn() @ " << addr << std::endl;
return nullptr;
}
llvm::Function* ret = nullptr;
std::set<Function*> newFncs;
for (auto* splitBb : newFncStarts)
{
Address splitAddr = getBasicBlockAddress(splitBb);
LOG << "\t\t\t\t" << "S: splitting @ " << splitAddr << " on "
<< splitBb->getName().str() << std::endl;
std::string name = _names->getPreferredNameForAddress(splitAddr);
if (name.empty())
{
name = names::generateFunctionName(splitAddr, _config->getConfig().isIda());
}
Function* oldFnc = splitBb->getParent();
Function* newFnc = Function::Create(
FunctionType::get(oldFnc->getReturnType(), false),
oldFnc->getLinkage(),
name);
oldFnc->getParent()->getFunctionList().insertAfter(
oldFnc->getIterator(),
newFnc);
addFunction(splitAddr, newFnc);
newFnc->getBasicBlockList().splice(
newFnc->begin(),
oldFnc->getBasicBlockList(),
splitBb->getIterator(),
oldFnc->getBasicBlockList().end());
newFncs.insert(oldFnc);
newFncs.insert(newFnc);
if (splitOnBb == splitBb)
{
ret = newFnc;
}
}
assert(ret);
for (Function* f : newFncs)
for (BasicBlock& b : *f)
{
auto* br = dyn_cast<BranchInst>(b.getTerminator());
if (br
&& (br->getSuccessor(0)->getParent() != br->getFunction()
|| br->getSuccessor(0)->getPrevNode() == nullptr))
{
auto* callee = br->getSuccessor(0)->getParent();
auto* c = CallInst::Create(callee, "", br);
if (auto* retObj = getCallReturnObject())
{
auto* cc = cast<Instruction>(
IrModifier::convertValueToTypeAfter(c, retObj->getValueType(), c));
auto* s = new StoreInst(cc, retObj);
s->insertAfter(cc);
}
ReturnInst::Create(
br->getModule()->getContext(),
UndefValue::get(br->getFunction()->getReturnType()),
br);
br->eraseFromParent();
}
// Test.
for (auto* s : successors(&b))
{
if (b.getParent() != s->getParent())
{
dumpModuleToFile(_module, _config->getOutputDirectory());
}
assert(b.getParent() == s->getParent());
}
}
return ret;
} | 337,843,546,095,104,400,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,969 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::CallInst* Decoder::transformToCondCall(
llvm::CallInst* pseudo,
llvm::Value* cond,
llvm::Function* callee,
llvm::BasicBlock* falseBb)
{
auto* oldBb = pseudo->getParent();
auto* newBb = oldBb->splitBasicBlock(pseudo);
// We do NOT want to name or give address to this block.
auto* oldTerm = oldBb->getTerminator();
BranchInst::Create(newBb, falseBb, cond, oldTerm);
oldTerm->eraseFromParent();
auto* newTerm = newBb->getTerminator();
BranchInst::Create(falseBb, newTerm);
newTerm->eraseFromParent();
auto* c = CallInst::Create(callee);
c->insertAfter(pseudo);
return c;
} | 163,582,491,722,408,650,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,970 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::Function* Decoder::splitFunctionOn(utils::Address addr)
{
if (auto* bb = getBasicBlockAtAddress(addr))
{
LOG << "\t\t\t\t" << "S: splitFunctionOn @ " << addr << std::endl;
return bb->getPrevNode()
? splitFunctionOn(addr, bb)
: bb->getParent();
}
// There is an instruction at address, but not BB -> do not split
// existing blocks to create functions.
//
else if (auto ai = AsmInstruction(_module, addr))
{
if (ai.isInvalid())
{
LOG << "\t\t\t\t" << "S: invalid ASM @ " << addr << std::endl;
return nullptr;
}
else
{
LOG << "\t\t\t\t" << "S: ASM @ " << addr << std::endl;
return nullptr;
}
}
else if (getFunctionContainingAddress(addr))
{
LOG << "\t\t\t\t" << "S: getFunctionContainingAddress() @ " << addr << std::endl;
auto* before = getBasicBlockBeforeAddress(addr);
assert(before);
auto* newBb = createBasicBlock(addr, before->getParent(), before);
return splitFunctionOn(addr, newBb);
}
else
{
LOG << "\t\t\t\t" << "S: createFunction() @ " << addr << std::endl;
return createFunction(addr);
}
} | 234,169,634,988,335,030,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,971 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::GlobalVariable* Decoder::getCallReturnObject()
{
if (_config->getConfig().architecture.isX86_32())
{
return _abi->getRegister(X86_REG_EAX);
}
else if (_config->getConfig().architecture.isX86_64())
{
return _abi->getRegister(X86_REG_RAX);
}
else if (_config->getConfig().architecture.isMipsOrPic32())
{
return _abi->getRegister(MIPS_REG_V0);
}
else if (_config->getConfig().architecture.isPpc())
{
return _abi->getRegister(PPC_REG_R3);
}
else if (_config->getConfig().architecture.isArm32OrThumb())
{
return _abi->getRegister(ARM_REG_R0);
}
else if (_config->getConfig().architecture.isArm64())
{
return _config->getLlvmRegister("r0");
}
assert(false);
return nullptr;
} | 179,506,904,574,203,230,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,972 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | void Decoder::getOrCreateCallTarget(
utils::Address addr,
llvm::Function*& tFnc,
llvm::BasicBlock*& tBb)
{
tBb = nullptr;
tFnc = nullptr;
if (auto* f = getFunctionAtAddress(addr))
{
tFnc = f;
tBb = tFnc->empty() ? nullptr : &tFnc->front();
LOG << "\t\t\t\t" << "F: getFunctionAtAddress() @ " << addr << std::endl;
}
else if (auto* f = splitFunctionOn(addr))
{
tFnc = f;
tBb = tFnc->empty() ? nullptr : &tFnc->front();
LOG << "\t\t\t\t" << "F: splitFunctionOn() @ " << addr << std::endl;
}
else if (auto* bb = getBasicBlockAtAddress(addr))
{
tBb = bb;
LOG << "\t\t\t\t" << "F: getBasicBlockAtAddress() @ " << addr << std::endl;
}
else if (getBasicBlockContainingAddress(addr))
{
// Nothing - we are not splitting BBs here.
LOG << "\t\t\t\t" << "F: getBasicBlockContainingAddress() @ "
<< addr << std::endl;
}
else if (getFunctionContainingAddress(addr))
{
auto* bb = getBasicBlockBeforeAddress(addr);
assert(bb);
tBb = createBasicBlock(addr, bb->getParent(), bb);
LOG << "\t\t\t\t" << "F: getFunctionContainingAddress() @ "
<< addr << std::endl;
}
else
{
tFnc = createFunction(addr);
tBb = tFnc && !tFnc->empty() ? &tFnc->front() : nullptr;
LOG << "\t\t\t\t" << "F: createFunction() @ "
<< addr << std::endl;
}
} | 248,275,155,997,215,700,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,973 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::ReturnInst* Decoder::transformToReturn(llvm::CallInst* pseudo)
{
auto* term = pseudo->getParent()->getTerminator();
assert(pseudo->getNextNode() == term);
auto* r = ReturnInst::Create(
pseudo->getModule()->getContext(),
UndefValue::get(pseudo->getFunction()->getReturnType()),
term);
term->eraseFromParent();
return r;
} | 246,227,948,483,677,530,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,974 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::BranchInst* Decoder::transformToBranch(
llvm::CallInst* pseudo,
llvm::BasicBlock* branchee)
{
auto* term = pseudo->getParent()->getTerminator();
assert(pseudo->getNextNode() == term);
auto* br = BranchInst::Create(branchee, term);
term->eraseFromParent();
return br;
} | 10,461,997,993,435,795,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,975 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::CallInst* Decoder::transformToCall(
llvm::CallInst* pseudo,
llvm::Function* callee)
{
auto* c = CallInst::Create(callee);
c->insertAfter(pseudo);
if (auto* retObj = getCallReturnObject())
{
auto* cc = cast<Instruction>(
IrModifier::convertValueToTypeAfter(c, retObj->getValueType(), c));
auto* s = new StoreInst(cc, retObj);
s->insertAfter(cc);
}
return c;
} | 206,281,456,132,457,940,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,976 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | bool Decoder::canSplitFunctionOn(
utils::Address addr,
llvm::BasicBlock* splitBb,
std::set<llvm::BasicBlock*>& newFncStarts)
{
newFncStarts.insert(splitBb);
auto* f = splitBb->getParent();
auto fAddr = getFunctionAddress(f);
auto fSzIt = _fnc2sz.find(f);
if (fSzIt != _fnc2sz.end())
{
if (fAddr <= addr && addr < (fAddr+fSzIt->second))
{
LOG << "\t\t\t\t\t" << "!CAN S: addr cond @ " << addr << std::endl;
return false;
}
}
std::set<Address> fncStarts;
fncStarts.insert(fAddr);
fncStarts.insert(addr);
LOG << "\t\t\t\t\t" << "CAN S: split @ " << fAddr << std::endl;
LOG << "\t\t\t\t\t" << "CAN S: split @ " << addr << std::endl;
bool changed = true;
while (changed)
{
changed = false;
for (BasicBlock& b : *f)
{
// Address bAddr = getBasicBlockAddress(&b);
Address bAddr;
// TODO: shitty
BasicBlock* bPrev = &b;
while (bAddr.isUndefined() && bPrev)
{
bAddr = getBasicBlockAddress(bPrev);
bPrev = bPrev->getPrevNode();
}
if (bAddr.isUndefined())
{
continue;
}
auto up = fncStarts.upper_bound(bAddr);
if (up == fncStarts.begin()) {
return false;
}
--up;
Address bFnc = *up;
for (auto* p : predecessors(&b))
{
// Address pAddr = getBasicBlockAddress(p);
Address pAddr;
// TODO: shitty
BasicBlock* pPrev = p;
while (pAddr.isUndefined() && pPrev)
{
pAddr = getBasicBlockAddress(pPrev);
pPrev = pPrev->getPrevNode();
}
if (pAddr.isUndefined())
{
continue;
}
auto up = fncStarts.upper_bound(pAddr);
if (up == fncStarts.begin()) {
return false;
}
--up;
Address pFnc = *up;
if (bFnc != pFnc)
{
if (!canSplitFunctionOn(&b))
{
return false;
}
changed |= newFncStarts.insert(&b).second;
changed |= fncStarts.insert(bAddr).second;
LOG << "\t\t\t\t\t" << "CAN S: split @ " << bAddr << std::endl;
}
}
}
}
return true;
} | 52,757,457,497,306,000,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,977 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | void Decoder::getOrCreateBranchTarget(
utils::Address addr,
llvm::BasicBlock*& tBb,
llvm::Function*& tFnc,
llvm::Instruction* from)
{
tBb = nullptr;
tFnc = nullptr;
auto* fromFnc = from->getFunction();
if (auto* bb = getBasicBlockAtAddress(addr))
{
tBb = bb;
LOG << "\t\t\t\t" << "B: getBasicBlockAtAddress() @ " << addr << std::endl;
}
else if (getBasicBlockContainingAddress(addr))
{
auto ai = AsmInstruction(_module, addr);
if (ai.isInvalid())
{
// Target in existing block, but not at existing instruction.
// Something is wrong, nothing we can do.
LOG << "\t\t\t\t" << "B: invalid ASM @ " << addr << std::endl;
return;
}
else if (ai.getFunction() == fromFnc)
{
tBb = ai.makeStart();
addBasicBlock(addr, tBb);
LOG << "\t\t\t\t" << "B: addBasicBlock @ " << addr << std::endl;
}
else
{
// Target at existing instruction, but in different function.
// Do not split existing block in other functions here.
LOG << "\t\t\t\t" << "B: ASM in diff fnc @ " << addr << std::endl;
return;
}
}
// Function without BBs (e.g. import declarations).
else if (auto* targetFnc = getFunctionAtAddress(addr))
{
tFnc = targetFnc;
LOG << "\t\t\t\t" << "B: getFunctionAtAddress() @ " << addr << std::endl;
}
else if (auto* bb = getBasicBlockBeforeAddress(addr))
{
tBb = createBasicBlock(addr, bb->getParent(), bb);
LOG << "\t\t\t\t" << "B: getBasicBlockBeforeAddress() @ " << addr << std::endl;
}
else
{
tFnc = createFunction(addr);
tBb = tFnc && !tFnc->empty() ? &tFnc->front() : nullptr;
LOG << "\t\t\t\t" << "B: default @ " << addr << std::endl;
}
if (tBb && tBb->getPrevNode() == nullptr)
{
tFnc = tBb->getParent();
}
if (tBb && tBb->getParent() == fromFnc)
{
return;
}
if (tFnc)
{
return;
}
LOG << "\t\t\t\t" << "B: splitFunctionOn @ " << addr << std::endl;
tFnc = splitFunctionOn(addr);
tBb = tFnc && !tFnc->empty() ? &tFnc->front() : tBb;
} | 160,056,055,851,785,500,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,978 | retdec | 517298bafaaff0a8e3dd60dd055a67c41b545807 | https://github.com/avast/retdec | https://github.com/avast/retdec/commit/517298bafaaff0a8e3dd60dd055a67c41b545807 | Try to fix issue #637
Reference: https://github.com/avast/retdec/issues/637 | 0 | llvm::BranchInst* Decoder::transformToCondBranch(
llvm::CallInst* pseudo,
llvm::Value* cond,
llvm::BasicBlock* trueBb,
llvm::BasicBlock* falseBb)
{
auto* term = pseudo->getParent()->getTerminator();
assert(pseudo->getNextNode() == term);
auto* br = BranchInst::Create(trueBb, falseBb, cond, term);
term->eraseFromParent();
return br;
} | 38,531,308,295,983,030,000,000,000,000,000,000,000 | None | null | [
"CWE-787"
] | CVE-2020-23907 | An issue was discovered in retdec v3.3. In function canSplitFunctionOn() of ir_modifications.cpp, there is a possible out of bounds read due to a heap buffer overflow. The impact is: Deny of Service, Memory Disclosure, and Possible Code Execution. | https://nvd.nist.gov/vuln/detail/CVE-2020-23907 |
520,979 | oocborrt | 539851c66778f68a244633985f6f8d0df94ea3b3 | https://github.com/objsys/oocborrt | https://github.com/objsys/oocborrt/commit/539851c66778f68a244633985f6f8d0df94ea3b3 | fixed missing return status test error | 0 | static int cborTagNotSupp (OSCTXT* pctxt, OSOCTET tag)
{
char numbuf[10];
char errtext[80];
rtxUIntToCharStr (tag, numbuf, sizeof(numbuf), 0);
rtxStrJoin (errtext, sizeof(errtext), "CBOR tag ", numbuf, 0, 0, 0);
rtxErrAddStrParm (pctxt, errtext);
return RTERR_NOTSUPP;
}
| 91,433,931,882,296,370,000,000,000,000,000,000,000 | None | null | [
"CWE-20"
] | CVE-2020-24753 | A memory corruption vulnerability in Objective Open CBOR Run-time (oocborrt) in versions before 2020-08-12 could allow an attacker to execute code via crafted Concise Binary Object Representation (CBOR) input to the cbor2json decoder. An uncaught error while decoding CBOR Major Type 3 text strings leads to the use of an attacker-controllable uninitialized stack value. This can be used to modify memory, causing a crash or potentially exploitable heap corruption. | https://nvd.nist.gov/vuln/detail/CVE-2020-24753 |
520,980 | oocborrt | 539851c66778f68a244633985f6f8d0df94ea3b3 | https://github.com/objsys/oocborrt | https://github.com/objsys/oocborrt/commit/539851c66778f68a244633985f6f8d0df94ea3b3 | fixed missing return status test error | 0 | static int cborElemNameToJson (OSCTXT* pCborCtxt, OSCTXT* pJsonCtxt)
{
char* pElemName = 0;
OSOCTET ub;
int ret;
/* Read byte from stream */
ret = rtxReadBytes (pCborCtxt, &ub, 1);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
/* Decode element name (note: only string type is currently supported) */
ret = rtCborDecDynUTF8Str (pCborCtxt, ub, &pElemName);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
/* Encode map element name as string */
ret = rtJsonEncStringValue (pJsonCtxt, (const OSUTF8CHAR*)pElemName);
rtxMemFreePtr (pCborCtxt, pElemName);
if (0 != ret) return LOG_RTERR (pJsonCtxt, ret);
OSRTSAFEPUTCHAR (pJsonCtxt, ':');
return 0;
}
| 309,262,024,382,791,750,000,000,000,000,000,000,000 | None | null | [
"CWE-20"
] | CVE-2020-24753 | A memory corruption vulnerability in Objective Open CBOR Run-time (oocborrt) in versions before 2020-08-12 could allow an attacker to execute code via crafted Concise Binary Object Representation (CBOR) input to the cbor2json decoder. An uncaught error while decoding CBOR Major Type 3 text strings leads to the use of an attacker-controllable uninitialized stack value. This can be used to modify memory, causing a crash or potentially exploitable heap corruption. | https://nvd.nist.gov/vuln/detail/CVE-2020-24753 |
520,981 | oocborrt | 539851c66778f68a244633985f6f8d0df94ea3b3 | https://github.com/objsys/oocborrt | https://github.com/objsys/oocborrt/commit/539851c66778f68a244633985f6f8d0df94ea3b3 | fixed missing return status test error | 0 | int main (int argc, char** argv)
{
OSCTXT jsonCtxt, cborCtxt;
OSOCTET* pMsgBuf = 0;
size_t msglen;
OSBOOL verbose = FALSE;
const char* filename = "message.cbor";
const char* outfname = "message.json";
int ret;
/* Process command line arguments */
if (argc > 1) {
int i;
for (i = 1; i < argc; i++) {
if (!strcmp (argv[i], "-v")) verbose = TRUE;
else if (!strcmp (argv[i], "-i")) filename = argv[++i];
else if (!strcmp (argv[i], "-o")) outfname = argv[++i];
else {
printf ("usage: cbor2json [-v] [-i <filename>] [-o filename]\n");
printf (" -v verbose mode: print trace info\n");
printf (" -i <filename> read CBOR msg from <filename>\n");
printf (" -o <filename> write JSON data to <filename>\n");
return 1;
}
}
}
/* Initialize context structures */
ret = rtxInitContext (&jsonCtxt);
if (ret != 0) {
rtxErrPrint (&jsonCtxt);
return ret;
}
rtxErrInit();
/* rtxSetDiag (&jsonCtxt, verbose); */
ret = rtxInitContext (&cborCtxt);
if (ret != 0) {
rtxErrPrint (&cborCtxt);
return ret;
}
/* rtxSetDiag (&cborCtxt, verbose); */
/* Create file input stream */
#if 0
/* Streaming not supported in open source version
ret = rtxStreamFileCreateReader (&jsonCtxt, filename);
*/
#else
/* Read input file into memory buffer */
ret = rtxFileReadBinary (&cborCtxt, filename, &pMsgBuf, &msglen);
if (0 == ret) {
ret = rtxInitContextBuffer (&cborCtxt, pMsgBuf, msglen);
}
#endif
if (0 != ret) {
rtxErrPrint (&jsonCtxt);
rtxFreeContext (&jsonCtxt);
rtxFreeContext (&cborCtxt);
return ret;
}
/* Init JSON output buffer */
ret = rtxInitContextBuffer (&jsonCtxt, 0, 0);
if (0 != ret) {
rtxErrPrint (&jsonCtxt);
rtxFreeContext (&jsonCtxt);
rtxFreeContext (&cborCtxt);
return ret;
}
/* Invoke the translation function */
ret = cbor2json (&cborCtxt, &jsonCtxt);
if (0 == ret && cborCtxt.level != 0)
ret = LOG_RTERR (&cborCtxt, RTERR_UNBAL);
if (0 == ret && 0 != outfname) {
/* Write encoded JSON data to output file */
OSRTSAFEPUTCHAR (&jsonCtxt, '\0'); /* null terminate buffer */
int fileret = rtxFileWriteText
(outfname, (const char*)jsonCtxt.buffer.data);
if (0 != fileret) {
printf ("unable to write message data to '%s', status = %d\n",
outfname, fileret);
}
}
if (0 != ret) {
rtxErrPrint (&jsonCtxt);
rtxErrPrint (&cborCtxt);
}
rtxFreeContext (&jsonCtxt);
rtxFreeContext (&cborCtxt);
return ret;
}
| 94,464,297,602,423,210,000,000,000,000,000,000,000 | None | null | [
"CWE-20"
] | CVE-2020-24753 | A memory corruption vulnerability in Objective Open CBOR Run-time (oocborrt) in versions before 2020-08-12 could allow an attacker to execute code via crafted Concise Binary Object Representation (CBOR) input to the cbor2json decoder. An uncaught error while decoding CBOR Major Type 3 text strings leads to the use of an attacker-controllable uninitialized stack value. This can be used to modify memory, causing a crash or potentially exploitable heap corruption. | https://nvd.nist.gov/vuln/detail/CVE-2020-24753 |
520,982 | oocborrt | 539851c66778f68a244633985f6f8d0df94ea3b3 | https://github.com/objsys/oocborrt | https://github.com/objsys/oocborrt/commit/539851c66778f68a244633985f6f8d0df94ea3b3 | fixed missing return status test error | 0 | static int cbor2json (OSCTXT* pCborCtxt, OSCTXT* pJsonCtxt)
{
int ret = 0;
OSOCTET tag, ub;
/* Read byte from stream */
ret = rtxReadBytes (pCborCtxt, &ub, 1);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
tag = ub >> 5;
/* Switch on tag value */
switch (tag) {
case OSRTCBOR_UINT: {
OSUINTTYPE value;
ret = rtCborDecUInt (pCborCtxt, ub, &value);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
/* Encode JSON */
#ifndef _NO_INT64_SUPPORT
ret = rtJsonEncUInt64Value (pJsonCtxt, value);
#else
ret = rtJsonEncUIntValue (pJsonCtxt, value);
#endif
if (0 != ret) return LOG_RTERR (pJsonCtxt, ret);
break;
}
case OSRTCBOR_NEGINT: {
OSINTTYPE value;
ret = rtCborDecInt (pCborCtxt, ub, &value);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
/* Encode JSON */
#ifndef _NO_INT64_SUPPORT
ret = rtJsonEncInt64Value (pJsonCtxt, value);
#else
ret = rtJsonEncIntValue (pJsonCtxt, value);
#endif
if (0 != ret) return LOG_RTERR (pJsonCtxt, ret);
break;
}
case OSRTCBOR_BYTESTR: {
OSDynOctStr64 byteStr;
ret = rtCborDecDynByteStr (pCborCtxt, ub, &byteStr);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
/* Encode JSON */
ret = rtJsonEncHexStr (pJsonCtxt, byteStr.numocts, byteStr.data);
rtxMemFreePtr (pCborCtxt, byteStr.data);
if (0 != ret) return LOG_RTERR (pJsonCtxt, ret);
break;
}
case OSRTCBOR_UTF8STR: {
OSUTF8CHAR* utf8str;
ret = rtCborDecDynUTF8Str (pCborCtxt, ub, (char**)&utf8str);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
ret = rtJsonEncStringValue (pJsonCtxt, utf8str);
rtxMemFreePtr (pCborCtxt, utf8str);
if (0 != ret) return LOG_RTERR (pJsonCtxt, ret);
break;
}
case OSRTCBOR_ARRAY:
case OSRTCBOR_MAP: {
OSOCTET len = ub & 0x1F;
char startChar = (tag == OSRTCBOR_ARRAY) ? '[' : '{';
char endChar = (tag == OSRTCBOR_ARRAY) ? ']' : '}';
OSRTSAFEPUTCHAR (pJsonCtxt, startChar);
if (len == OSRTCBOR_INDEF) {
OSBOOL first = TRUE;
for (;;) {
if (OSRTCBOR_MATCHEOC (pCborCtxt)) {
pCborCtxt->buffer.byteIndex++;
break;
}
if (!first)
OSRTSAFEPUTCHAR (pJsonCtxt, ',');
else
first = FALSE;
/* If map, decode object name */
if (tag == OSRTCBOR_MAP) {
ret = cborElemNameToJson (pCborCtxt, pJsonCtxt);
}
/* Make recursive call */
if (0 == ret)
ret = cbor2json (pCborCtxt, pJsonCtxt);
if (0 != ret) {
OSCTXT* pctxt =
(rtxErrGetErrorCnt(pJsonCtxt) > 0) ? pJsonCtxt : pCborCtxt;
return LOG_RTERR (pctxt, ret);
}
}
}
else { /* definite length */
OSSIZE nitems;
/* Decode tag and number of items */
ret = rtCborDecSize (pCborCtxt, len, &nitems);
if (0 == ret) {
OSSIZE i;
/* Loop to decode array items */
for (i = 0; i < nitems; i++) {
if (0 != i) OSRTSAFEPUTCHAR (pJsonCtxt, ',');
/* If map, decode object name */
if (tag == OSRTCBOR_MAP) {
ret = cborElemNameToJson (pCborCtxt, pJsonCtxt);
}
/* Make recursive call */
if (0 == ret)
ret = cbor2json (pCborCtxt, pJsonCtxt);
if (0 != ret) {
OSCTXT* pctxt =
(rtxErrGetErrorCnt(pJsonCtxt) > 0) ? pJsonCtxt : pCborCtxt;
return LOG_RTERR (pctxt, ret);
}
}
}
}
OSRTSAFEPUTCHAR (pJsonCtxt, endChar);
break;
}
case OSRTCBOR_FLOAT:
if (tag == OSRTCBOR_FALSEENC || tag == OSRTCBOR_TRUEENC) {
OSBOOL boolval = (ub == OSRTCBOR_TRUEENC) ? TRUE : FALSE;
ret = rtJsonEncBoolValue (pJsonCtxt, boolval);
if (0 != ret) return LOG_RTERR (pJsonCtxt, ret);
}
else if (tag == OSRTCBOR_FLT16ENC ||
tag == OSRTCBOR_FLT32ENC ||
tag == OSRTCBOR_FLT64ENC) {
OSDOUBLE fltval;
ret = rtCborDecFloat (pCborCtxt, ub, &fltval);
if (0 != ret) return LOG_RTERR (pCborCtxt, ret);
/* Encode JSON */
ret = rtJsonEncDoubleValue (pJsonCtxt, fltval, 0);
if (0 != ret) return LOG_RTERR (pJsonCtxt, ret);
}
else {
ret = cborTagNotSupp (pCborCtxt, tag);
}
break;
default:
ret = cborTagNotSupp (pCborCtxt, tag);
}
return ret;
}
| 182,192,642,033,756,700,000,000,000,000,000,000,000 | None | null | [
"CWE-20"
] | CVE-2020-24753 | A memory corruption vulnerability in Objective Open CBOR Run-time (oocborrt) in versions before 2020-08-12 could allow an attacker to execute code via crafted Concise Binary Object Representation (CBOR) input to the cbor2json decoder. An uncaught error while decoding CBOR Major Type 3 text strings leads to the use of an attacker-controllable uninitialized stack value. This can be used to modify memory, causing a crash or potentially exploitable heap corruption. | https://nvd.nist.gov/vuln/detail/CVE-2020-24753 |
521,499 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const char *zRight) {
struct Db *pDb = &db->aDb[iDb];
codec_ctx *ctx = NULL;
int rc;
if(pDb->pBt) {
ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager);
}
CODEC_TRACE("sqlcipher_codec_pragma: entered db=%p iDb=%d pParse=%p zLeft=%s zRight=%s ctx=%p\n", db, iDb, pParse, zLeft, zRight, ctx);
#ifdef SQLCIPHER_EXT
if( sqlite3StrICmp(zLeft, "cipher_license")==0 && zRight ){
char *license_result = sqlite3_mprintf("%d", sqlcipher_license_key(zRight));
codec_vdbe_return_string(pParse, "cipher_license", license_result, P4_DYNAMIC);
} else
if( sqlite3StrICmp(zLeft, "cipher_license")==0 && !zRight ){
if(ctx) {
char *license_result = sqlite3_mprintf("%d", ctx
? sqlcipher_license_key_status(ctx->provider)
: SQLITE_ERROR);
codec_vdbe_return_string(pParse, "cipher_license", license_result, P4_DYNAMIC);
}
} else
#endif
#ifdef SQLCIPHER_TEST
if( sqlite3StrICmp(zLeft,"cipher_fail_next_encrypt")==0 ){
if( zRight ) {
cipher_fail_next_encrypt = sqlite3GetBoolean(zRight,1);
} else {
char *fail = sqlite3_mprintf("%d", cipher_fail_next_encrypt);
codec_vdbe_return_string(pParse, "cipher_fail_next_encrypt", fail, P4_DYNAMIC);
}
}else
if( sqlite3StrICmp(zLeft,"cipher_fail_next_decrypt")==0 ){
if( zRight ) {
cipher_fail_next_decrypt = sqlite3GetBoolean(zRight,1);
} else {
char *fail = sqlite3_mprintf("%d", cipher_fail_next_decrypt);
codec_vdbe_return_string(pParse, "cipher_fail_next_decrypt", fail, P4_DYNAMIC);
}
}else
#endif
if( sqlite3StrICmp(zLeft, "cipher_fips_status")== 0 && !zRight ){
if(ctx) {
char *fips_mode_status = sqlite3_mprintf("%d", sqlcipher_codec_fips_status(ctx));
codec_vdbe_return_string(pParse, "cipher_fips_status", fips_mode_status, P4_DYNAMIC);
}
} else
if( sqlite3StrICmp(zLeft, "cipher_store_pass")==0 && zRight ) {
if(ctx) {
char *deprecation = "PRAGMA cipher_store_pass is deprecated, please remove from use";
sqlcipher_codec_set_store_pass(ctx, sqlite3GetBoolean(zRight, 1));
codec_vdbe_return_string(pParse, "cipher_store_pass", deprecation, P4_TRANSIENT);
sqlite3_log(SQLITE_WARNING, deprecation);
}
} else
if( sqlite3StrICmp(zLeft, "cipher_store_pass")==0 && !zRight ) {
if(ctx){
char *store_pass_value = sqlite3_mprintf("%d", sqlcipher_codec_get_store_pass(ctx));
codec_vdbe_return_string(pParse, "cipher_store_pass", store_pass_value, P4_DYNAMIC);
}
}
if( sqlite3StrICmp(zLeft, "cipher_profile")== 0 && zRight ){
char *profile_status = sqlite3_mprintf("%d", sqlcipher_cipher_profile(db, zRight));
codec_vdbe_return_string(pParse, "cipher_profile", profile_status, P4_DYNAMIC);
} else
if( sqlite3StrICmp(zLeft, "cipher_add_random")==0 && zRight ){
if(ctx) {
char *add_random_status = sqlite3_mprintf("%d", sqlcipher_codec_add_random(ctx, zRight, sqlite3Strlen30(zRight)));
codec_vdbe_return_string(pParse, "cipher_add_random", add_random_status, P4_DYNAMIC);
}
} else
if( sqlite3StrICmp(zLeft, "cipher_migrate")==0 && !zRight ){
if(ctx){
char *migrate_status = sqlite3_mprintf("%d", sqlcipher_codec_ctx_migrate(ctx));
codec_vdbe_return_string(pParse, "cipher_migrate", migrate_status, P4_DYNAMIC);
}
} else
if( sqlite3StrICmp(zLeft, "cipher_provider")==0 && !zRight ){
if(ctx) { codec_vdbe_return_string(pParse, "cipher_provider",
sqlcipher_codec_get_cipher_provider(ctx), P4_TRANSIENT);
}
} else
if( sqlite3StrICmp(zLeft, "cipher_provider_version")==0 && !zRight){
if(ctx) { codec_vdbe_return_string(pParse, "cipher_provider_version",
sqlcipher_codec_get_provider_version(ctx), P4_TRANSIENT);
}
} else
if( sqlite3StrICmp(zLeft, "cipher_version")==0 && !zRight ){
codec_vdbe_return_string(pParse, "cipher_version", sqlcipher_version(), P4_DYNAMIC);
}else
if( sqlite3StrICmp(zLeft, "cipher")==0 ){
if(ctx) {
if( zRight ) {
const char* message = "PRAGMA cipher is no longer supported.";
codec_vdbe_return_string(pParse, "cipher", message, P4_TRANSIENT);
sqlite3_log(SQLITE_WARNING, message);
}else {
codec_vdbe_return_string(pParse, "cipher", sqlcipher_codec_ctx_get_cipher(ctx), P4_TRANSIENT);
}
}
}else
if( sqlite3StrICmp(zLeft, "rekey_cipher")==0 && zRight ){
const char* message = "PRAGMA rekey_cipher is no longer supported.";
codec_vdbe_return_string(pParse, "rekey_cipher", message, P4_TRANSIENT);
sqlite3_log(SQLITE_WARNING, message);
}else
if( sqlite3StrICmp(zLeft,"cipher_default_kdf_iter")==0 ){
if( zRight ) {
sqlcipher_set_default_kdf_iter(atoi(zRight)); /* change default KDF iterations */
} else {
char *kdf_iter = sqlite3_mprintf("%d", sqlcipher_get_default_kdf_iter());
codec_vdbe_return_string(pParse, "cipher_default_kdf_iter", kdf_iter, P4_DYNAMIC);
}
}else
if( sqlite3StrICmp(zLeft, "kdf_iter")==0 ){
if(ctx) {
if( zRight ) {
sqlcipher_codec_ctx_set_kdf_iter(ctx, atoi(zRight)); /* change of RW PBKDF2 iteration */
} else {
char *kdf_iter = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_kdf_iter(ctx));
codec_vdbe_return_string(pParse, "kdf_iter", kdf_iter, P4_DYNAMIC);
}
}
}else
if( sqlite3StrICmp(zLeft, "fast_kdf_iter")==0){
if(ctx) {
if( zRight ) {
char *deprecation = "PRAGMA fast_kdf_iter is deprecated, please remove from use";
sqlcipher_codec_ctx_set_fast_kdf_iter(ctx, atoi(zRight)); /* change of RW PBKDF2 iteration */
codec_vdbe_return_string(pParse, "fast_kdf_iter", deprecation, P4_TRANSIENT);
sqlite3_log(SQLITE_WARNING, deprecation);
} else {
char *fast_kdf_iter = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_fast_kdf_iter(ctx));
codec_vdbe_return_string(pParse, "fast_kdf_iter", fast_kdf_iter, P4_DYNAMIC);
}
}
}else
if( sqlite3StrICmp(zLeft, "rekey_kdf_iter")==0 && zRight ){
const char* message = "PRAGMA rekey_kdf_iter is no longer supported.";
codec_vdbe_return_string(pParse, "rekey_kdf_iter", message, P4_TRANSIENT);
sqlite3_log(SQLITE_WARNING, message);
}else
if( sqlite3StrICmp(zLeft,"cipher_page_size")==0 ){
if(ctx) {
if( zRight ) {
int size = atoi(zRight);
rc = sqlcipher_codec_ctx_set_pagesize(ctx, size);
if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);
rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx);
if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);
} else {
char * page_size = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_pagesize(ctx));
codec_vdbe_return_string(pParse, "cipher_page_size", page_size, P4_DYNAMIC);
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_default_page_size")==0 ){
if( zRight ) {
sqlcipher_set_default_pagesize(atoi(zRight));
} else {
char *default_page_size = sqlite3_mprintf("%d", sqlcipher_get_default_pagesize());
codec_vdbe_return_string(pParse, "cipher_default_page_size", default_page_size, P4_DYNAMIC);
}
}else
if( sqlite3StrICmp(zLeft,"cipher_default_use_hmac")==0 ){
if( zRight ) {
sqlcipher_set_default_use_hmac(sqlite3GetBoolean(zRight,1));
} else {
char *default_use_hmac = sqlite3_mprintf("%d", sqlcipher_get_default_use_hmac());
codec_vdbe_return_string(pParse, "cipher_default_use_hmac", default_use_hmac, P4_DYNAMIC);
}
}else
if( sqlite3StrICmp(zLeft,"cipher_use_hmac")==0 ){
if(ctx) {
if( zRight ) {
rc = sqlcipher_codec_ctx_set_use_hmac(ctx, sqlite3GetBoolean(zRight,1));
if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);
/* since the use of hmac has changed, the page size may also change */
rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx);
if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);
} else {
char *hmac_flag = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_use_hmac(ctx));
codec_vdbe_return_string(pParse, "cipher_use_hmac", hmac_flag, P4_DYNAMIC);
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_hmac_pgno")==0 ){
if(ctx) {
if(zRight) {
char *deprecation = "PRAGMA cipher_hmac_pgno is deprecated, please remove from use";
/* clear both pgno endian flags */
if(sqlite3StrICmp(zRight, "le") == 0) {
sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_BE_PGNO);
sqlcipher_codec_ctx_set_flag(ctx, CIPHER_FLAG_LE_PGNO);
} else if(sqlite3StrICmp(zRight, "be") == 0) {
sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_LE_PGNO);
sqlcipher_codec_ctx_set_flag(ctx, CIPHER_FLAG_BE_PGNO);
} else if(sqlite3StrICmp(zRight, "native") == 0) {
sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_LE_PGNO);
sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_BE_PGNO);
}
codec_vdbe_return_string(pParse, "cipher_hmac_pgno", deprecation, P4_TRANSIENT);
sqlite3_log(SQLITE_WARNING, deprecation);
} else {
if(sqlcipher_codec_ctx_get_flag(ctx, CIPHER_FLAG_LE_PGNO)) {
codec_vdbe_return_string(pParse, "cipher_hmac_pgno", "le", P4_TRANSIENT);
} else if(sqlcipher_codec_ctx_get_flag(ctx, CIPHER_FLAG_BE_PGNO)) {
codec_vdbe_return_string(pParse, "cipher_hmac_pgno", "be", P4_TRANSIENT);
} else {
codec_vdbe_return_string(pParse, "cipher_hmac_pgno", "native", P4_TRANSIENT);
}
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_hmac_salt_mask")==0 ){
if(ctx) {
if(zRight) {
char *deprecation = "PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use";
if (sqlite3StrNICmp(zRight ,"x'", 2) == 0 && sqlite3Strlen30(zRight) == 5) {
unsigned char mask = 0;
const unsigned char *hex = (const unsigned char *)zRight+2;
cipher_hex2bin(hex,2,&mask);
sqlcipher_set_hmac_salt_mask(mask);
}
codec_vdbe_return_string(pParse, "cipher_hmac_salt_mask", deprecation, P4_TRANSIENT);
sqlite3_log(SQLITE_WARNING, deprecation);
} else {
char *hmac_salt_mask = sqlite3_mprintf("%02x", sqlcipher_get_hmac_salt_mask());
codec_vdbe_return_string(pParse, "cipher_hmac_salt_mask", hmac_salt_mask, P4_DYNAMIC);
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_plaintext_header_size")==0 ){
if(ctx) {
if( zRight ) {
int size = atoi(zRight);
/* deliberately ignore result code, if size is invalid it will be set to -1
and trip the error later in the codec */
sqlcipher_codec_ctx_set_plaintext_header_size(ctx, size);
} else {
char *size = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_plaintext_header_size(ctx));
codec_vdbe_return_string(pParse, "cipher_plaintext_header_size", size, P4_DYNAMIC);
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_default_plaintext_header_size")==0 ){
if( zRight ) {
sqlcipher_set_default_plaintext_header_size(atoi(zRight));
} else {
char *size = sqlite3_mprintf("%d", sqlcipher_get_default_plaintext_header_size());
codec_vdbe_return_string(pParse, "cipher_default_plaintext_header_size", size, P4_DYNAMIC);
}
}else
if( sqlite3StrICmp(zLeft,"cipher_salt")==0 ){
if(ctx) {
if(zRight) {
if (sqlite3StrNICmp(zRight ,"x'", 2) == 0 && sqlite3Strlen30(zRight) == (FILE_HEADER_SZ*2)+3) {
unsigned char *salt = (unsigned char*) sqlite3_malloc(FILE_HEADER_SZ);
const unsigned char *hex = (const unsigned char *)zRight+2;
cipher_hex2bin(hex,FILE_HEADER_SZ*2,salt);
sqlcipher_codec_ctx_set_kdf_salt(ctx, salt, FILE_HEADER_SZ);
sqlite3_free(salt);
}
} else {
void *salt;
char *hexsalt = (char*) sqlite3_malloc((FILE_HEADER_SZ*2)+1);
if((rc = sqlcipher_codec_ctx_get_kdf_salt(ctx, &salt)) == SQLITE_OK) {
cipher_bin2hex(salt, FILE_HEADER_SZ, hexsalt);
codec_vdbe_return_string(pParse, "cipher_salt", hexsalt, P4_DYNAMIC);
} else {
sqlite3_free(hexsalt);
sqlcipher_codec_ctx_set_error(ctx, rc);
}
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_hmac_algorithm")==0 ){
if(ctx) {
if(zRight) {
rc = SQLITE_ERROR;
if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) {
rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA1);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) {
rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA256);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA512_LABEL) == 0) {
rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA512);
}
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
} else {
int algorithm = sqlcipher_codec_ctx_get_hmac_algorithm(ctx);
if(algorithm == SQLCIPHER_HMAC_SHA1) {
codec_vdbe_return_string(pParse, "cipher_hmac_algorithm", SQLCIPHER_HMAC_SHA1_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_HMAC_SHA256) {
codec_vdbe_return_string(pParse, "cipher_hmac_algorithm", SQLCIPHER_HMAC_SHA256_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_HMAC_SHA512) {
codec_vdbe_return_string(pParse, "cipher_hmac_algorithm", SQLCIPHER_HMAC_SHA512_LABEL, P4_TRANSIENT);
}
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_default_hmac_algorithm")==0 ){
if(zRight) {
rc = SQLITE_ERROR;
if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) {
rc = sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA1);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) {
rc = sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA256);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA512_LABEL) == 0) {
rc = sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA512);
}
} else {
int algorithm = sqlcipher_get_default_hmac_algorithm();
if(algorithm == SQLCIPHER_HMAC_SHA1) {
codec_vdbe_return_string(pParse, "cipher_default_hmac_algorithm", SQLCIPHER_HMAC_SHA1_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_HMAC_SHA256) {
codec_vdbe_return_string(pParse, "cipher_default_hmac_algorithm", SQLCIPHER_HMAC_SHA256_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_HMAC_SHA512) {
codec_vdbe_return_string(pParse, "cipher_default_hmac_algorithm", SQLCIPHER_HMAC_SHA512_LABEL, P4_TRANSIENT);
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_kdf_algorithm")==0 ){
if(ctx) {
if(zRight) {
rc = SQLITE_ERROR;
if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) {
rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA1);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) {
rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA256);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL) == 0) {
rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA512);
}
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
} else {
int algorithm = sqlcipher_codec_ctx_get_kdf_algorithm(ctx);
if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA1) {
codec_vdbe_return_string(pParse, "cipher_kdf_algorithm", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA256) {
codec_vdbe_return_string(pParse, "cipher_kdf_algorithm", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA512) {
codec_vdbe_return_string(pParse, "cipher_kdf_algorithm", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL, P4_TRANSIENT);
}
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_default_kdf_algorithm")==0 ){
if(zRight) {
rc = SQLITE_ERROR;
if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) {
rc = sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA1);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) {
rc = sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA256);
} else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL) == 0) {
rc = sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA512);
}
} else {
int algorithm = sqlcipher_get_default_kdf_algorithm();
if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA1) {
codec_vdbe_return_string(pParse, "cipher_default_kdf_algorithm", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA256) {
codec_vdbe_return_string(pParse, "cipher_default_kdf_algorithm", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL, P4_TRANSIENT);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA512) {
codec_vdbe_return_string(pParse, "cipher_default_kdf_algorithm", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL, P4_TRANSIENT);
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_compatibility")==0 ){
if(ctx) {
if(zRight) {
int version = atoi(zRight);
switch(version) {
case 1:
rc = sqlcipher_codec_ctx_set_pagesize(ctx, 1024);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_iter(ctx, 4000);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_use_hmac(ctx, 0);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
break;
case 2:
rc = sqlcipher_codec_ctx_set_pagesize(ctx, 1024);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_iter(ctx, 4000);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_use_hmac(ctx, 1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
break;
case 3:
rc = sqlcipher_codec_ctx_set_pagesize(ctx, 1024);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_iter(ctx, 64000);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_use_hmac(ctx, 1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
break;
default:
rc = sqlcipher_codec_ctx_set_pagesize(ctx, 4096);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA512);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA512);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_kdf_iter(ctx, 256000);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
rc = sqlcipher_codec_ctx_set_use_hmac(ctx, 1);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
break;
}
rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx);
if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_default_compatibility")==0 ){
if(zRight) {
int version = atoi(zRight);
switch(version) {
case 1:
sqlcipher_set_default_pagesize(1024);
sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA1);
sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA1);
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(0);
break;
case 2:
sqlcipher_set_default_pagesize(1024);
sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA1);
sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA1);
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(1);
break;
case 3:
sqlcipher_set_default_pagesize(1024);
sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA1);
sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA1);
sqlcipher_set_default_kdf_iter(64000);
sqlcipher_set_default_use_hmac(1);
break;
default:
sqlcipher_set_default_pagesize(4096);
sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA512);
sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA512);
sqlcipher_set_default_kdf_iter(256000);
sqlcipher_set_default_use_hmac(1);
break;
}
}
}else
if( sqlite3StrICmp(zLeft,"cipher_memory_security")==0 ){
if( zRight ) {
sqlcipher_set_mem_security(sqlite3GetBoolean(zRight,1));
} else {
char *on = sqlite3_mprintf("%d", sqlcipher_get_mem_security());
codec_vdbe_return_string(pParse, "cipher_memory_security", on, P4_DYNAMIC);
}
}else
if( sqlite3StrICmp(zLeft,"cipher_settings")==0 ){
if(ctx) {
int algorithm;
char *pragma;
pragma = sqlite3_mprintf("PRAGMA kdf_iter = %d;", sqlcipher_codec_ctx_get_kdf_iter(ctx));
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
pragma = sqlite3_mprintf("PRAGMA cipher_page_size = %d;", sqlcipher_codec_ctx_get_pagesize(ctx));
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
pragma = sqlite3_mprintf("PRAGMA cipher_use_hmac = %d;", sqlcipher_codec_ctx_get_use_hmac(ctx));
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
pragma = sqlite3_mprintf("PRAGMA cipher_plaintext_header_size = %d;", sqlcipher_codec_ctx_get_plaintext_header_size(ctx));
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
algorithm = sqlcipher_codec_ctx_get_hmac_algorithm(ctx);
pragma = NULL;
if(algorithm == SQLCIPHER_HMAC_SHA1) {
pragma = sqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA1_LABEL);
} else if(algorithm == SQLCIPHER_HMAC_SHA256) {
pragma = sqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA256_LABEL);
} else if(algorithm == SQLCIPHER_HMAC_SHA512) {
pragma = sqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA512_LABEL);
}
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
algorithm = sqlcipher_codec_ctx_get_kdf_algorithm(ctx);
pragma = NULL;
if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA1) {
pragma = sqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA256) {
pragma = sqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA512) {
pragma = sqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL);
}
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
}
}else
if( sqlite3StrICmp(zLeft,"cipher_default_settings")==0 ){
int algorithm;
char *pragma;
pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_iter = %d;", sqlcipher_get_default_kdf_iter());
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
pragma = sqlite3_mprintf("PRAGMA cipher_default_page_size = %d;", sqlcipher_get_default_pagesize());
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
pragma = sqlite3_mprintf("PRAGMA cipher_default_use_hmac = %d;", sqlcipher_get_default_use_hmac());
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
pragma = sqlite3_mprintf("PRAGMA cipher_default_plaintext_header_size = %d;", sqlcipher_get_default_plaintext_header_size());
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
algorithm = sqlcipher_get_default_hmac_algorithm();
pragma = NULL;
if(algorithm == SQLCIPHER_HMAC_SHA1) {
pragma = sqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA1_LABEL);
} else if(algorithm == SQLCIPHER_HMAC_SHA256) {
pragma = sqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA256_LABEL);
} else if(algorithm == SQLCIPHER_HMAC_SHA512) {
pragma = sqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA512_LABEL);
}
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
algorithm = sqlcipher_get_default_kdf_algorithm();
pragma = NULL;
if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA1) {
pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA256) {
pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL);
} else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA512) {
pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL);
}
codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC);
}else
if( sqlite3StrICmp(zLeft,"cipher_integrity_check")==0 ){
if(ctx) {
sqlcipher_codec_ctx_integrity_check(ctx, pParse, "cipher_integrity_check");
}
}else {
return 0;
}
return 1;
} | 210,718,390,088,926,000,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,500 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | void sqlite3_activate_see(const char* in) {
/* do nothing, security enhancements are always active */
} | 240,603,999,562,817,100,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,501 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | int sqlite3CodecAttach(sqlite3* db, int nDb, const void *zKey, int nKey) {
struct Db *pDb = &db->aDb[nDb];
CODEC_TRACE("sqlite3CodecAttach: entered db=%p, nDb=%d zKey=%s, nKey=%d\n", db, nDb, (char *)zKey, nKey);
if(nKey && zKey && pDb->pBt) {
int rc;
Pager *pPager = pDb->pBt->pBt->pPager;
sqlite3_file *fd;
codec_ctx *ctx;
/* check if the sqlite3_file is open, and if not force handle to NULL */
if((fd = sqlite3PagerFile(pPager))->pMethods == 0) fd = NULL;
CODEC_TRACE("sqlite3CodecAttach: calling sqlcipher_activate()\n");
sqlcipher_activate(); /* perform internal initialization for sqlcipher */
CODEC_TRACE_MUTEX("sqlite3CodecAttach: entering database mutex %p\n", db->mutex);
sqlite3_mutex_enter(db->mutex);
CODEC_TRACE_MUTEX("sqlite3CodecAttach: entered database mutex %p\n", db->mutex);
#ifdef SQLCIPHER_EXT
if((rc = sqlite3_set_authorizer(db, sqlcipher_license_authorizer, db)) != SQLITE_OK) {
sqlite3_mutex_leave(db->mutex);
return rc;
}
#endif
/* point the internal codec argument against the contet to be prepared */
CODEC_TRACE("sqlite3CodecAttach: calling sqlcipher_codec_ctx_init()\n");
rc = sqlcipher_codec_ctx_init(&ctx, pDb, pDb->pBt->pBt->pPager, zKey, nKey);
if(rc != SQLITE_OK) {
/* initialization failed, do not attach potentially corrupted context */
CODEC_TRACE("sqlite3CodecAttach: context initialization failed with rc=%d\n", rc);
/* force an error at the pager level, such that even the upstream caller ignores the return code
the pager will be in an error state and will process no further operations */
sqlite3pager_error(pPager, rc);
pDb->pBt->pBt->db->errCode = rc;
CODEC_TRACE_MUTEX("sqlite3CodecAttach: leaving database mutex %p (early return on rc=%d)\n", db->mutex, rc);
sqlite3_mutex_leave(db->mutex);
CODEC_TRACE_MUTEX("sqlite3CodecAttach: left database mutex %p (early return on rc=%d)\n", db->mutex, rc);
return rc;
}
CODEC_TRACE("sqlite3CodecAttach: calling sqlite3PagerSetCodec()\n");
sqlite3PagerSetCodec(sqlite3BtreePager(pDb->pBt), sqlite3Codec, NULL, sqlite3FreeCodecArg, (void *) ctx);
CODEC_TRACE("sqlite3CodecAttach: calling codec_set_btree_to_codec_pagesize()\n");
codec_set_btree_to_codec_pagesize(db, pDb, ctx);
/* force secure delete. This has the benefit of wiping internal data when deleted
and also ensures that all pages are written to disk (i.e. not skipped by
sqlite3PagerDontWrite optimizations) */
CODEC_TRACE("sqlite3CodecAttach: calling sqlite3BtreeSecureDelete()\n");
sqlite3BtreeSecureDelete(pDb->pBt, 1);
/* if fd is null, then this is an in-memory database and
we dont' want to overwrite the AutoVacuum settings
if not null, then set to the default */
if(fd != NULL) {
CODEC_TRACE("sqlite3CodecAttach: calling sqlite3BtreeSetAutoVacuum()\n");
sqlite3BtreeSetAutoVacuum(pDb->pBt, SQLITE_DEFAULT_AUTOVACUUM);
}
CODEC_TRACE_MUTEX("sqlite3CodecAttach: leaving database mutex %p\n", db->mutex);
sqlite3_mutex_leave(db->mutex);
CODEC_TRACE_MUTEX("sqlite3CodecAttach: left database mutex %p\n", db->mutex);
}
return SQLITE_OK;
} | 86,282,026,045,468,520,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,502 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static int sqlcipher_finalize(sqlite3 *db, sqlite3_stmt *pStmt, char **pzErrMsg){
int rc;
rc = sqlite3VdbeFinalize((Vdbe*)pStmt);
if( rc ){
sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));
}
return rc;
} | 150,989,832,449,633,320,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,503 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static int codec_set_pass_key(sqlite3* db, int nDb, const void *zKey, int nKey, int for_ctx) {
struct Db *pDb = &db->aDb[nDb];
CODEC_TRACE("codec_set_pass_key: entered db=%p nDb=%d zKey=%s nKey=%d for_ctx=%d\n", db, nDb, (char *)zKey, nKey, for_ctx);
if(pDb->pBt) {
codec_ctx *ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager);
if(ctx) return sqlcipher_codec_ctx_set_pass(ctx, zKey, nKey, for_ctx);
}
return SQLITE_ERROR;
} | 113,965,764,517,113,100,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,504 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static int sqlcipher_execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
sqlite3_stmt *pStmt;
int rc;
rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
if( rc!=SQLITE_OK ) return rc;
while( SQLITE_ROW==sqlite3_step(pStmt) ){
rc = sqlcipher_execSql(db, pzErrMsg, (char*)sqlite3_column_text(pStmt, 0));
if( rc!=SQLITE_OK ){
sqlcipher_finalize(db, pStmt, pzErrMsg);
return rc;
}
}
return sqlcipher_finalize(db, pStmt, pzErrMsg);
} | 73,930,657,758,115,480,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,505 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static void codec_vdbe_return_string(Parse *pParse, const char *zLabel, const char *value, int value_type){
Vdbe *v = sqlite3GetVdbe(pParse);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC);
sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, value, value_type);
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
} | 17,568,490,585,757,700,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,506 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **argv) {
sqlite3 *db = sqlite3_context_db_handle(context);
const char* targetDb, *sourceDb;
int targetDb_idx = 0;
u64 saved_flags = db->flags; /* Saved value of the db->flags */
u32 saved_mDbFlags = db->mDbFlags; /* Saved value of the db->mDbFlags */
int saved_nChange = db->nChange; /* Saved value of db->nChange */
int saved_nTotalChange = db->nTotalChange; /* Saved value of db->nTotalChange */
u8 saved_mTrace = db->mTrace; /* Saved value of db->mTrace */
int rc = SQLITE_OK; /* Return code from service routines */
char *zSql = NULL; /* SQL statements */
char *pzErrMsg = NULL;
if(argc != 1 && argc != 2) {
rc = SQLITE_ERROR;
pzErrMsg = sqlite3_mprintf("invalid number of arguments (%d) passed to sqlcipher_export", argc);
goto end_of_export;
}
if(sqlite3_value_type(argv[0]) == SQLITE_NULL) {
rc = SQLITE_ERROR;
pzErrMsg = sqlite3_mprintf("target database can't be NULL");
goto end_of_export;
}
targetDb = (const char*) sqlite3_value_text(argv[0]);
sourceDb = "main";
if(argc == 2) {
if(sqlite3_value_type(argv[1]) == SQLITE_NULL) {
rc = SQLITE_ERROR;
pzErrMsg = sqlite3_mprintf("target database can't be NULL");
goto end_of_export;
}
sourceDb = (char *) sqlite3_value_text(argv[1]);
}
/* if the name of the target is not main, but the index returned is zero
there is a mismatch and we should not proceed */
targetDb_idx = sqlcipher_find_db_index(db, targetDb);
if(targetDb_idx == 0 && targetDb != NULL && sqlite3StrICmp("main", targetDb) != 0) {
rc = SQLITE_ERROR;
pzErrMsg = sqlite3_mprintf("unknown database %s", targetDb);
goto end_of_export;
}
db->init.iDb = targetDb_idx;
db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks;
db->mDbFlags |= DBFLAG_PreferBuiltin | DBFLAG_Vacuum;
db->flags &= ~(u64)(SQLITE_ForeignKeys | SQLITE_ReverseOrder | SQLITE_Defensive | SQLITE_CountRows);
db->mTrace = 0;
/* Query the schema of the main database. Create a mirror schema
** in the temporary database.
*/
zSql = sqlite3_mprintf(
"SELECT sql "
" FROM %s.sqlite_master WHERE type='table' AND name!='sqlite_sequence'"
" AND rootpage>0"
, sourceDb);
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
if( rc!=SQLITE_OK ) goto end_of_export;
sqlite3_free(zSql);
zSql = sqlite3_mprintf(
"SELECT sql "
" FROM %s.sqlite_master WHERE sql LIKE 'CREATE INDEX %%' "
, sourceDb);
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
if( rc!=SQLITE_OK ) goto end_of_export;
sqlite3_free(zSql);
zSql = sqlite3_mprintf(
"SELECT sql "
" FROM %s.sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %%'"
, sourceDb);
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
if( rc!=SQLITE_OK ) goto end_of_export;
sqlite3_free(zSql);
/* Loop through the tables in the main database. For each, do
** an "INSERT INTO rekey_db.xxx SELECT * FROM main.xxx;" to copy
** the contents to the temporary database.
*/
zSql = sqlite3_mprintf(
"SELECT 'INSERT INTO %s.' || quote(name) "
"|| ' SELECT * FROM %s.' || quote(name) || ';'"
"FROM %s.sqlite_master "
"WHERE type = 'table' AND name!='sqlite_sequence' "
" AND rootpage>0"
, targetDb, sourceDb, sourceDb);
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
if( rc!=SQLITE_OK ) goto end_of_export;
sqlite3_free(zSql);
/* Copy over the contents of the sequence table
*/
zSql = sqlite3_mprintf(
"SELECT 'INSERT INTO %s.' || quote(name) "
"|| ' SELECT * FROM %s.' || quote(name) || ';' "
"FROM %s.sqlite_master WHERE name=='sqlite_sequence';"
, targetDb, sourceDb, targetDb);
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql);
if( rc!=SQLITE_OK ) goto end_of_export;
sqlite3_free(zSql);
/* Copy the triggers, views, and virtual tables from the main database
** over to the temporary database. None of these objects has any
** associated storage, so all we have to do is copy their entries
** from the SQLITE_MASTER table.
*/
zSql = sqlite3_mprintf(
"INSERT INTO %s.sqlite_master "
" SELECT type, name, tbl_name, rootpage, sql"
" FROM %s.sqlite_master"
" WHERE type='view' OR type='trigger'"
" OR (type='table' AND rootpage=0)"
, targetDb, sourceDb);
rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execSql(db, &pzErrMsg, zSql);
if( rc!=SQLITE_OK ) goto end_of_export;
sqlite3_free(zSql);
zSql = NULL;
end_of_export:
db->init.iDb = 0;
db->flags = saved_flags;
db->mDbFlags = saved_mDbFlags;
db->nChange = saved_nChange;
db->nTotalChange = saved_nTotalChange;
db->mTrace = saved_mTrace;
if(zSql) sqlite3_free(zSql);
if(rc) {
if(pzErrMsg != NULL) {
sqlite3_result_error(context, pzErrMsg, -1);
sqlite3DbFree(db, pzErrMsg);
} else {
sqlite3_result_error(context, sqlite3ErrStr(rc), -1);
}
}
} | 291,673,322,331,677,800,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,507 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | int sqlite3_key(sqlite3 *db, const void *pKey, int nKey) {
CODEC_TRACE("sqlite3_key entered: db=%p pKey=%s nKey=%d\n", db, (char *)pKey, nKey);
return sqlite3_key_v2(db, "main", pKey, nKey);
} | 55,890,209,071,705,450,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,508 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static int codec_set_btree_to_codec_pagesize(sqlite3 *db, Db *pDb, codec_ctx *ctx) {
int rc, page_sz, reserve_sz;
page_sz = sqlcipher_codec_ctx_get_pagesize(ctx);
reserve_sz = sqlcipher_codec_ctx_get_reservesize(ctx);
CODEC_TRACE("codec_set_btree_to_codec_pagesize: sqlite3BtreeSetPageSize() size=%d reserve=%d\n", page_sz, reserve_sz);
CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: entering database mutex %p\n", db->mutex);
sqlite3_mutex_enter(db->mutex);
CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: entered database mutex %p\n", db->mutex);
db->nextPagesize = page_sz;
/* before forcing the page size we need to unset the BTS_PAGESIZE_FIXED flag, else
sqliteBtreeSetPageSize will block the change */
pDb->pBt->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED;
rc = sqlite3BtreeSetPageSize(pDb->pBt, page_sz, reserve_sz, 0);
CODEC_TRACE("codec_set_btree_to_codec_pagesize: sqlite3BtreeSetPageSize returned %d\n", rc);
CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: leaving database mutex %p\n", db->mutex);
sqlite3_mutex_leave(db->mutex);
CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: left database mutex %p\n", db->mutex);
return rc;
} | 231,366,181,439,557,500,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,509 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static void* sqlite3Codec(void *iCtx, void *data, Pgno pgno, int mode) {
codec_ctx *ctx = (codec_ctx *) iCtx;
int offset = 0, rc = 0;
int page_sz = sqlcipher_codec_ctx_get_pagesize(ctx);
unsigned char *pData = (unsigned char *) data;
void *buffer = sqlcipher_codec_ctx_get_data(ctx);
int plaintext_header_sz = sqlcipher_codec_ctx_get_plaintext_header_size(ctx);
int cctx = CIPHER_READ_CTX;
CODEC_TRACE("sqlite3Codec: entered pgno=%d, mode=%d, page_sz=%d\n", pgno, mode, page_sz);
#ifdef SQLCIPHER_EXT
if(sqlcipher_license_check(ctx) != SQLITE_OK) return NULL;
#endif
/* call to derive keys if not present yet */
if((rc = sqlcipher_codec_key_derive(ctx)) != SQLITE_OK) {
sqlcipher_codec_ctx_set_error(ctx, rc);
return NULL;
}
/* if the plaintext_header_size is negative that means an invalid size was set via
PRAGMA. We can't set the error state on the pager at that point because the pager
may not be open yet. However, this is a fatal error state, so abort the codec */
if(plaintext_header_sz < 0) {
sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR);
return NULL;
}
if(pgno == 1) /* adjust starting pointers in data page for header offset on first page*/
offset = plaintext_header_sz ? plaintext_header_sz : FILE_HEADER_SZ;
CODEC_TRACE("sqlite3Codec: switch mode=%d offset=%d\n", mode, offset);
switch(mode) {
case CODEC_READ_OP: /* decrypt */
if(pgno == 1) /* copy initial part of file header or SQLite magic to buffer */
memcpy(buffer, plaintext_header_sz ? pData : (void *) SQLITE_FILE_HEADER, offset);
rc = sqlcipher_page_cipher(ctx, cctx, pgno, CIPHER_DECRYPT, page_sz - offset, pData + offset, (unsigned char*)buffer + offset);
#ifdef SQLCIPHER_TEST
if(cipher_fail_next_decrypt) rc = SQLITE_ERROR;
#endif
if(rc != SQLITE_OK) { /* clear results of failed cipher operation and set error */
sqlcipher_memset((unsigned char*) buffer+offset, 0, page_sz-offset);
sqlcipher_codec_ctx_set_error(ctx, rc);
}
memcpy(pData, buffer, page_sz); /* copy buffer data back to pData and return */
return pData;
break;
case CODEC_WRITE_OP: /* encrypt database page, operate on write context and fall through to case 7, so the write context is used*/
cctx = CIPHER_WRITE_CTX;
case CODEC_JOURNAL_OP: /* encrypt journal page, operate on read context use to get the original page data from the database */
if(pgno == 1) { /* copy initial part of file header or salt to buffer */
void *kdf_salt = NULL;
/* retrieve the kdf salt */
if((rc = sqlcipher_codec_ctx_get_kdf_salt(ctx, &kdf_salt)) != SQLITE_OK) {
sqlcipher_codec_ctx_set_error(ctx, rc);
return NULL;
}
memcpy(buffer, plaintext_header_sz ? pData : kdf_salt, offset);
}
rc = sqlcipher_page_cipher(ctx, cctx, pgno, CIPHER_ENCRYPT, page_sz - offset, pData + offset, (unsigned char*)buffer + offset);
#ifdef SQLCIPHER_TEST
if(cipher_fail_next_encrypt) rc = SQLITE_ERROR;
#endif
if(rc != SQLITE_OK) { /* clear results of failed cipher operation and set error */
sqlcipher_memset((unsigned char*)buffer+offset, 0, page_sz-offset);
sqlcipher_codec_ctx_set_error(ctx, rc);
return NULL;
}
return buffer; /* return persistent buffer data, pData remains intact */
break;
default:
sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR); /* unsupported mode, set error */
return pData;
break;
}
} | 120,525,436,105,512,950,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,510 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | int sqlite3_rekey_v2(sqlite3 *db, const char *zDb, const void *pKey, int nKey) {
CODEC_TRACE("sqlite3_rekey_v2: entered db=%p zDb=%s pKey=%s, nKey=%d\n", db, zDb, (char *)pKey, nKey);
if(db && pKey && nKey) {
int db_index = sqlcipher_find_db_index(db, zDb);
struct Db *pDb = &db->aDb[db_index];
CODEC_TRACE("sqlite3_rekey_v2: database pDb=%p db_index:%d\n", pDb, db_index);
if(pDb->pBt) {
codec_ctx *ctx;
int rc, page_count;
Pgno pgno;
PgHdr *page;
Pager *pPager = pDb->pBt->pBt->pPager;
ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager);
if(ctx == NULL) {
/* there was no codec attached to this database, so this should do nothing! */
CODEC_TRACE("sqlite3_rekey_v2: no codec attached to db, exiting\n");
return SQLITE_OK;
}
CODEC_TRACE_MUTEX("sqlite3_rekey_v2: entering database mutex %p\n", db->mutex);
sqlite3_mutex_enter(db->mutex);
CODEC_TRACE_MUTEX("sqlite3_rekey_v2: entered database mutex %p\n", db->mutex);
codec_set_pass_key(db, db_index, pKey, nKey, CIPHER_WRITE_CTX);
/* do stuff here to rewrite the database
** 1. Create a transaction on the database
** 2. Iterate through each page, reading it and then writing it.
** 3. If that goes ok then commit and put ctx->rekey into ctx->key
** note: don't deallocate rekey since it may be used in a subsequent iteration
*/
rc = sqlite3BtreeBeginTrans(pDb->pBt, 1, 0); /* begin write transaction */
sqlite3PagerPagecount(pPager, &page_count);
for(pgno = 1; rc == SQLITE_OK && pgno <= (unsigned int)page_count; pgno++) { /* pgno's start at 1 see pager.c:pagerAcquire */
if(!sqlite3pager_is_mj_pgno(pPager, pgno)) { /* skip this page (see pager.c:pagerAcquire for reasoning) */
rc = sqlite3PagerGet(pPager, pgno, &page, 0);
if(rc == SQLITE_OK) { /* write page see pager_incr_changecounter for example */
rc = sqlite3PagerWrite(page);
if(rc == SQLITE_OK) {
sqlite3PagerUnref(page);
} else {
CODEC_TRACE("sqlite3_rekey_v2: error %d occurred writing page %d\n", rc, pgno);
}
} else {
CODEC_TRACE("sqlite3_rekey_v2: error %d occurred getting page %d\n", rc, pgno);
}
}
}
/* if commit was successful commit and copy the rekey data to current key, else rollback to release locks */
if(rc == SQLITE_OK) {
CODEC_TRACE("sqlite3_rekey_v2: committing\n");
rc = sqlite3BtreeCommit(pDb->pBt);
sqlcipher_codec_key_copy(ctx, CIPHER_WRITE_CTX);
} else {
CODEC_TRACE("sqlite3_rekey_v2: rollback\n");
sqlite3BtreeRollback(pDb->pBt, SQLITE_ABORT_ROLLBACK, 0);
}
CODEC_TRACE_MUTEX("sqlite3_rekey_v2: leaving database mutex %p\n", db->mutex);
sqlite3_mutex_leave(db->mutex);
CODEC_TRACE_MUTEX("sqlite3_rekey_v2: left database mutex %p\n", db->mutex);
}
return SQLITE_OK;
}
return SQLITE_ERROR;
} | 54,074,107,687,568,530,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,511 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static void sqlite3FreeCodecArg(void *pCodecArg) {
codec_ctx *ctx = (codec_ctx *) pCodecArg;
if(pCodecArg == NULL) return;
sqlcipher_codec_ctx_free(&ctx); /* wipe and free allocated memory for the context */
sqlcipher_deactivate(); /* cleanup related structures, OpenSSL etc, when codec is detatched */
} | 193,060,164,115,461,920,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,512 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | static int sqlcipher_execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
sqlite3_stmt *pStmt;
VVA_ONLY( int rc; )
if( !zSql ){
return SQLITE_NOMEM;
}
if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){
sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));
return sqlite3_errcode(db);
}
VVA_ONLY( rc = ) sqlite3_step(pStmt);
assert( rc!=SQLITE_ROW );
return sqlcipher_finalize(db, pStmt, pzErrMsg);
} | 160,233,460,793,917,870,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,513 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey) {
CODEC_TRACE("sqlite3_rekey entered: db=%p pKey=%s nKey=%d\n", db, (char *)pKey, nKey);
return sqlite3_rekey_v2(db, "main", pKey, nKey);
} | 191,606,247,726,643,400,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,514 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | int sqlite3_key_v2(sqlite3 *db, const char *zDb, const void *pKey, int nKey) {
CODEC_TRACE("sqlite3_key_v2: entered db=%p zDb=%s pKey=%s nKey=%d\n", db, zDb, (char *)pKey, nKey);
/* attach key if db and pKey are not null and nKey is > 0 */
if(db && pKey && nKey) {
int db_index = sqlcipher_find_db_index(db, zDb);
return sqlite3CodecAttach(db, db_index, pKey, nKey);
}
return SQLITE_ERROR;
} | 263,859,736,813,268,150,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,515 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | int sqlcipher_find_db_index(sqlite3 *db, const char *zDb) {
int db_index;
if(zDb == NULL){
return 0;
}
for(db_index = 0; db_index < db->nDb; db_index++) {
struct Db *pDb = &db->aDb[db_index];
if(strcmp(pDb->zDbSName, zDb) == 0) {
return db_index;
}
}
return 0;
} | 321,382,141,115,475,200,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
521,516 | sqlcipher | cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | https://github.com/sqlcipher/sqlcipher | https://github.com/sqlcipher/sqlcipher/commit/cb71f53e8cea4802509f182fa5bead0ac6ab0e7f | fix sqlcipher_export handling of NULL parameters | 0 | void sqlite3CodecGetKey(sqlite3* db, int nDb, void **zKey, int *nKey) {
struct Db *pDb = &db->aDb[nDb];
CODEC_TRACE("sqlite3CodecGetKey: entered db=%p, nDb=%d\n", db, nDb);
if( pDb->pBt ) {
codec_ctx *ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager);
if(ctx) {
/* pass back the keyspec from the codec, unless PRAGMA cipher_store_pass
is set or keyspec has not yet been derived, in which case pass
back the password key material */
sqlcipher_codec_get_keyspec(ctx, zKey, nKey);
if(sqlcipher_codec_get_store_pass(ctx) == 1 || *zKey == NULL) {
sqlcipher_codec_get_pass(ctx, zKey, nKey);
}
} else {
*zKey = NULL;
*nKey = 0;
}
}
} | 79,918,361,212,436,000,000,000,000,000,000,000,000 | None | null | [
"CWE-476"
] | CVE-2021-3119 | Zetetic SQLCipher 4.x before 4.4.3 has a NULL pointer dereferencing issue related to sqlcipher_export in crypto.c and sqlite3StrICmp in sqlite3.c. This may allow an attacker to perform a remote denial of service attack. For example, an SQL injection can be used to execute the crafted SQL command sequence, which causes a segmentation fault. | https://nvd.nist.gov/vuln/detail/CVE-2021-3119 |
522,366 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::reset) {
Nan::HandleScope scope;
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(info.This());
if (!tw->txn) {
return Nan::ThrowError("The transaction is already closed.");
}
mdb_txn_reset(tw->txn);
} | 60,457,954,544,277,010,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,367 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::getStringUnsafe) {
return getCommon(info, valToStringUnsafe);
} | 236,338,861,112,838,170,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,368 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | TxnWrap::~TxnWrap() {
// Close if not closed already
if (this->txn) {
mdb_txn_abort(txn);
this->removeFromEnvWrap();
}
} | 123,930,430,147,199,690,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,369 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::renew) {
Nan::HandleScope scope;
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(info.This());
if (!tw->txn) {
return Nan::ThrowError("The transaction is already closed.");
}
int rc = mdb_txn_renew(tw->txn);
if (rc != 0) {
return throwLmdbError(rc);
}
} | 34,879,962,823,629,910,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,370 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::getBinaryUnsafe) {
return getCommon(info, valToBinaryUnsafe);
} | 124,596,560,158,399,750,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,371 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | TxnWrap::TxnWrap(MDB_env *env, MDB_txn *txn) {
this->env = env;
this->txn = txn;
this->flags = 0;
} | 3,318,558,263,858,188,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,372 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::putString) {
if (!info[2]->IsString())
return Nan::ThrowError("Value must be a string.");
return putCommon(info, [](Nan::NAN_METHOD_ARGS_TYPE info, MDB_val &data) -> void {
CustomExternalStringResource::writeTo(Local<String>::Cast(info[2]), &data);
}, [](MDB_val &data) -> void {
delete[] (uint16_t*)data.mv_data;
});
} | 74,502,503,904,513,100,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,373 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::putNumber) {
return putCommon(info, [](Nan::NAN_METHOD_ARGS_TYPE info, MDB_val &data) -> void {
auto numberLocal = Nan::To<v8::Number>(info[2]).ToLocalChecked();
numberToPut = numberLocal->Value();
data.mv_size = sizeof(double);
data.mv_data = &numberToPut;
}, nullptr);
} | 161,110,328,495,980,290,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,374 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::del) {
Nan::HandleScope scope;
// Check argument count
auto argCount = info.Length();
if (argCount < 2 || argCount > 4) {
return Nan::ThrowError("Invalid number of arguments to cursor.del, should be: (a) <dbi>, <key> (b) <dbi>, <key>, <options> (c) <dbi>, <key>, <data> (d) <dbi>, <key>, <data>, <options>");
}
// Unwrap native objects
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(info.This());
DbiWrap *dw = Nan::ObjectWrap::Unwrap<DbiWrap>(Local<Object>::Cast(info[0]));
if (!tw->txn) {
return Nan::ThrowError("The transaction is already closed.");
}
// Take care of options object and data handle
Local<Value> options;
Local<Value> dataHandle;
if (argCount == 4) {
options = info[3];
dataHandle = info[2];
}
else if (argCount == 3) {
if (info[2]->IsObject()) {
options = info[2];
dataHandle = Nan::Undefined();
}
else {
options = Nan::Undefined();
dataHandle = info[2];
}
}
else if (argCount == 2) {
options = Nan::Undefined();
dataHandle = Nan::Undefined();
}
else {
return Nan::ThrowError("Unknown arguments to cursor.del, this could be a node-lmdb bug!");
}
MDB_val key;
bool keyIsValid;
auto keyType = inferAndValidateKeyType(info[1], options, dw->keyType, keyIsValid);
if (!keyIsValid) {
// inferAndValidateKeyType already threw an error
return;
}
auto freeKey = argToKey(info[1], key, keyType, keyIsValid);
if (!keyIsValid) {
// argToKey already threw an error
return;
}
// Set data if dupSort true and data given
MDB_val data;
bool freeData = false;
if ((dw->flags & MDB_DUPSORT) && !(dataHandle->IsUndefined())) {
if (dataHandle->IsString()) {
CustomExternalStringResource::writeTo(Local<String>::Cast(dataHandle), &data);
freeData = true;
}
else if (node::Buffer::HasInstance(dataHandle)) {
data.mv_size = node::Buffer::Length(dataHandle);
data.mv_data = node::Buffer::Data(dataHandle);
freeData = true;
}
else if (dataHandle->IsNumber()) {
auto numberLocal = Nan::To<v8::Number>(dataHandle).ToLocalChecked();
data.mv_size = sizeof(double);
data.mv_data = new double;
*reinterpret_cast<double*>(data.mv_data) = numberLocal->Value();
freeData = true;
}
else if (dataHandle->IsBoolean()) {
auto booleanLocal = Nan::To<v8::Boolean>(dataHandle).ToLocalChecked();
data.mv_size = sizeof(double);
data.mv_data = new bool;
*reinterpret_cast<bool*>(data.mv_data) = booleanLocal->Value();
freeData = true;
}
else {
Nan::ThrowError("Invalid data type.");
}
}
int rc = mdb_del(tw->txn, dw->dbi, &key, freeData ? &data : nullptr);
if (freeKey) {
freeKey(key);
}
if (freeData) {
if (dataHandle->IsString()) {
delete[] (uint16_t*)data.mv_data;
}
else if (node::Buffer::HasInstance(dataHandle)) {
// I think the data is owned by the node::Buffer so we don't need to free it - need to clarify
}
else if (dataHandle->IsNumber()) {
delete (double*)data.mv_data;
}
else if (dataHandle->IsBoolean()) {
delete (bool*)data.mv_data;
}
}
if (rc != 0) {
return throwLmdbError(rc);
}
} | 167,750,490,431,939,200,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,375 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::abort) {
Nan::HandleScope scope;
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(info.This());
if (!tw->txn) {
return Nan::ThrowError("The transaction is already closed.");
}
mdb_txn_abort(tw->txn);
tw->removeFromEnvWrap();
tw->txn = nullptr;
} | 299,871,228,575,706,400,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,376 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::ctor) {
Nan::HandleScope scope;
EnvWrap *ew = Nan::ObjectWrap::Unwrap<EnvWrap>(Local<Object>::Cast(info[0]));
int flags = 0;
if (info[1]->IsObject()) {
Local<Object> options = Local<Object>::Cast(info[1]);
// Get flags from options
setFlagFromValue(&flags, MDB_RDONLY, "readOnly", false, options);
}
// Check existence of current write transaction
if (0 == (flags & MDB_RDONLY) && ew->currentWriteTxn != nullptr) {
return Nan::ThrowError("You have already opened a write transaction in the current process, can't open a second one.");
}
MDB_txn *txn;
int rc = mdb_txn_begin(ew->env, nullptr, flags, &txn);
if (rc != 0) {
if (rc == EINVAL) {
return Nan::ThrowError("Invalid parameter, which on MacOS is often due to more transactions than available robust locked semaphors (see node-lmdb docs for more info)");
}
return throwLmdbError(rc);
}
TxnWrap* tw = new TxnWrap(ew->env, txn);
tw->flags = flags;
tw->ew = ew;
tw->ew->Ref();
tw->Wrap(info.This());
// Set the current write transaction
if (0 == (flags & MDB_RDONLY)) {
ew->currentWriteTxn = tw;
}
else {
ew->readTxns.push_back(tw);
}
return info.GetReturnValue().Set(info.This());
} | 182,791,328,426,997,030,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,377 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::getBoolean) {
return getCommon(info, valToBoolean);
} | 223,508,738,397,270,870,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,378 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::getBinary) {
return getCommon(info, valToBinary);
} | 204,473,871,683,747,200,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,379 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::commit) {
Nan::HandleScope scope;
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(info.This());
if (!tw->txn) {
return Nan::ThrowError("The transaction is already closed.");
}
int rc = mdb_txn_commit(tw->txn);
tw->removeFromEnvWrap();
tw->txn = nullptr;
if (rc != 0) {
return throwLmdbError(rc);
}
} | 87,809,197,599,161,280,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,380 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | void TxnWrap::removeFromEnvWrap() {
if (this->ew) {
if (this->ew->currentWriteTxn == this) {
this->ew->currentWriteTxn = nullptr;
}
else {
auto it = std::find(ew->readTxns.begin(), ew->readTxns.end(), this);
if (it != ew->readTxns.end()) {
ew->readTxns.erase(it);
}
}
this->ew->Unref();
this->ew = nullptr;
}
} | 99,122,763,629,656,950,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,381 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | Nan::NAN_METHOD_RETURN_TYPE TxnWrap::getCommon(Nan::NAN_METHOD_ARGS_TYPE info, Local<Value> (*successFunc)(MDB_val&)) {
Nan::HandleScope scope;
if (info.Length() != 2 && info.Length() != 3) {
return Nan::ThrowError("Invalid number of arguments to cursor.get");
}
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(info.This());
DbiWrap *dw = Nan::ObjectWrap::Unwrap<DbiWrap>(Local<Object>::Cast(info[0]));
if (!tw->txn) {
return Nan::ThrowError("The transaction is already closed.");
}
MDB_val key, oldkey, data;
bool keyIsValid;
auto keyType = inferAndValidateKeyType(info[1], info[2], dw->keyType, keyIsValid);
if (!keyIsValid) {
// inferAndValidateKeyType already threw an error
return;
}
auto freeKey = argToKey(info[1], key, keyType, keyIsValid);
if (!keyIsValid) {
// argToKey already threw an error
return;
}
// Bookkeeping for old key so that we can free it even if key will point inside LMDB
oldkey.mv_data = key.mv_data;
oldkey.mv_size = key.mv_size;
int rc = mdb_get(tw->txn, dw->dbi, &key, &data);
if (freeKey) {
freeKey(oldkey);
}
if (rc == MDB_NOTFOUND) {
return info.GetReturnValue().Set(Nan::Null());
}
else if (rc != 0) {
return throwLmdbError(rc);
}
else {
return info.GetReturnValue().Set(successFunc(data));
}
} | 231,543,547,489,732,560,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,382 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::getNumber) {
return getCommon(info, valToNumber);
} | 76,876,237,783,665,510,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,383 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | Nan::NAN_METHOD_RETURN_TYPE TxnWrap::putCommon(Nan::NAN_METHOD_ARGS_TYPE info, void (*fillFunc)(Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&), void (*freeData)(MDB_val&)) {
Nan::HandleScope scope;
if (info.Length() != 3 && info.Length() != 4) {
return Nan::ThrowError("Invalid number of arguments to txn.put");
}
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(info.This());
DbiWrap *dw = Nan::ObjectWrap::Unwrap<DbiWrap>(Local<Object>::Cast(info[0]));
if (!tw->txn) {
return Nan::ThrowError("The transaction is already closed.");
}
int flags = 0;
MDB_val key, data;
bool keyIsValid;
auto keyType = inferAndValidateKeyType(info[1], info[3], dw->keyType, keyIsValid);
if (!keyIsValid) {
// inferAndValidateKeyType already threw an error
return;
}
auto freeKey = argToKey(info[1], key, keyType, keyIsValid);
if (!keyIsValid) {
// argToKey already threw an error
return;
}
if (!info[3]->IsNull() && !info[3]->IsUndefined() && info[3]->IsObject()) {
auto options = Local<Object>::Cast(info[3]);
setFlagFromValue(&flags, MDB_NODUPDATA, "noDupData", false, options);
setFlagFromValue(&flags, MDB_NOOVERWRITE, "noOverwrite", false, options);
setFlagFromValue(&flags, MDB_APPEND, "append", false, options);
setFlagFromValue(&flags, MDB_APPENDDUP, "appendDup", false, options);
// NOTE: does not make sense to support MDB_RESERVE, because it wouldn't save the memcpy from V8 to lmdb
}
// Fill key and data
fillFunc(info, data);
// Keep a copy of the original key and data, so we can free them
MDB_val originalKey = key;
MDB_val originalData = data;
int rc = mdb_put(tw->txn, dw->dbi, &key, &data, flags);
// Free original key and data (what was supplied by the user, not what points to lmdb)
if (freeKey) {
freeKey(originalKey);
}
if (freeData) {
freeData(originalData);
}
// Check result code
if (rc != 0) {
return throwLmdbError(rc);
}
} | 80,758,908,337,401,980,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,384 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::putBinary) {
return putCommon(info, [](Nan::NAN_METHOD_ARGS_TYPE info, MDB_val &data) -> void {
data.mv_size = node::Buffer::Length(info[2]);
data.mv_data = node::Buffer::Data(info[2]);
}, [](MDB_val &) -> void {
// The data is owned by the node::Buffer so we don't need to free it.
});
} | 31,124,891,366,588,017,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,385 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::getString) {
return getCommon(info, valToString);
} | 225,893,783,809,469,350,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,386 | node-lmdb | 97760104c0fd311206b88aecd91fa1f59fe2b85a | https://github.com/Venemo/node-lmdb | https://github.com/Venemo/node-lmdb/commit/97760104c0fd311206b88aecd91fa1f59fe2b85a | Perform argument check for putString | 0 | NAN_METHOD(TxnWrap::putBoolean) {
return putCommon(info, [](Nan::NAN_METHOD_ARGS_TYPE info, MDB_val &data) -> void {
auto booleanLocal = Nan::To<v8::Boolean>(info[2]).ToLocalChecked();
booleanToPut = booleanLocal->Value();
data.mv_size = sizeof(bool);
data.mv_data = &booleanToPut;
}, nullptr);
} | 249,464,519,442,557,060,000,000,000,000,000,000,000 | None | null | [
"NVD-CWE-noinfo"
] | CVE-2022-21164 | The package node-lmdb before 0.9.7 are vulnerable to Denial of Service (DoS) when defining a non-invokable ToString value, which will cause a crash during type check. | https://nvd.nist.gov/vuln/detail/CVE-2022-21164 |
522,442 | maddy | 7ee6a39c6a1939b376545f030a5efd6f90913583 | https://github.com/foxcpp/maddy | https://github.com/foxcpp/maddy/commit/7ee6a39c6a1939b376545f030a5efd6f90913583 | auth/pam: Check for account/password expiry
See GHSA-6cp7-g972-w9m9. Thanks Youssef Rebahi-Gilbert (ysf) for
reporting the issue. | 0 | static int conv_func(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) {
*resp = (struct pam_response*)appdata_ptr;
return PAM_SUCCESS;
} | 223,400,127,245,454,900,000,000,000,000,000,000,000 | None | null | [
"CWE-613"
] | CVE-2022-24732 | Maddy Mail Server is an open source SMTP compatible email server. Versions of maddy prior to 0.5.4 do not implement password expiry or account expiry checking when authenticating using PAM. Users are advised to upgrade. Users unable to upgrade should manually remove expired accounts via existing filtering mechanisms. | https://nvd.nist.gov/vuln/detail/CVE-2022-24732 |
522,443 | maddy | 7ee6a39c6a1939b376545f030a5efd6f90913583 | https://github.com/foxcpp/maddy | https://github.com/foxcpp/maddy/commit/7ee6a39c6a1939b376545f030a5efd6f90913583 | auth/pam: Check for account/password expiry
See GHSA-6cp7-g972-w9m9. Thanks Youssef Rebahi-Gilbert (ysf) for
reporting the issue. | 0 | struct error_obj run_pam_auth(const char *username, char *password) {
// PAM frees pam_response for us.
struct pam_response *reply = malloc(sizeof(struct pam_response));
if (reply == NULL) {
struct error_obj ret_val;
ret_val.status = 2;
ret_val.func_name = "malloc";
ret_val.error_msg = "Out of memory";
return ret_val;
}
reply->resp = password;
reply->resp_retcode = 0;
const struct pam_conv local_conv = { conv_func, reply };
pam_handle_t *local_auth = NULL;
int status = pam_start("maddy", username, &local_conv, &local_auth);
if (status != PAM_SUCCESS) {
struct error_obj ret_val;
ret_val.status = 2;
ret_val.func_name = "pam_start";
ret_val.error_msg = pam_strerror(local_auth, status);
return ret_val;
}
status = pam_authenticate(local_auth, PAM_SILENT|PAM_DISALLOW_NULL_AUTHTOK);
if (status != PAM_SUCCESS) {
struct error_obj ret_val;
if (status == PAM_AUTH_ERR || status == PAM_USER_UNKNOWN) {
ret_val.status = 1;
} else {
ret_val.status = 2;
}
ret_val.func_name = "pam_authenticate";
ret_val.error_msg = pam_strerror(local_auth, status);
return ret_val;
}
status = pam_acct_mgmt(local_auth, PAM_SILENT|PAM_DISALLOW_NULL_AUTHTOK);
if (status != PAM_SUCCESS) {
struct error_obj ret_val;
if (status == PAM_AUTH_ERR || status == PAM_USER_UNKNOWN || status == PAM_NEW_AUTHTOK_REQD) {
ret_val.status = 1;
} else {
ret_val.status = 2;
}
ret_val.func_name = "pam_acct_mgmt";
ret_val.error_msg = pam_strerror(local_auth, status);
return ret_val;
}
status = pam_end(local_auth, status);
if (status != PAM_SUCCESS) {
struct error_obj ret_val;
ret_val.status = 2;
ret_val.func_name = "pam_end";
ret_val.error_msg = pam_strerror(local_auth, status);
return ret_val;
}
struct error_obj ret_val;
ret_val.status = 0;
ret_val.func_name = NULL;
ret_val.error_msg = NULL;
return ret_val;
} | 311,322,554,352,065,030,000,000,000,000,000,000,000 | None | null | [
"CWE-613"
] | CVE-2022-24732 | Maddy Mail Server is an open source SMTP compatible email server. Versions of maddy prior to 0.5.4 do not implement password expiry or account expiry checking when authenticating using PAM. Users are advised to upgrade. Users unable to upgrade should manually remove expired accounts via existing filtering mechanisms. | https://nvd.nist.gov/vuln/detail/CVE-2022-24732 |