func_name stringlengths 2 53 | func_src_before stringlengths 63 114k | func_src_after stringlengths 86 114k | line_changes dict | char_changes dict | commit_link stringlengths 66 117 | file_name stringlengths 5 72 | vul_type stringclasses 9
values |
|---|---|---|---|---|---|---|---|
quiz | @app.route('/quiz')
def quiz():
varga = request.args.get('varga')
try:
rows =[]
with sql.connect('amara.db') as con:
con.row_factory = sql.Row
cur = con.cursor()
cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada... | @app.route('/quiz')
def quiz():
varga = request.args.get('varga')
try:
rows =[]
with sql.connect('amara.db') as con:
con.row_factory = sql.Row
cur = con.cursor()
cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada... | {
"deleted": [
{
"line_no": 12,
"char_start": 213,
"char_end": 371,
"line": " cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = '%s' order by random() limit 1;\" % varga)\n"
},
{
"line_no": 16,
"char_star... | {
"deleted": [
{
"char_start": 329,
"char_end": 333,
"chars": "'%s'"
},
{
"char_start": 361,
"char_end": 363,
"chars": " %"
},
{
"char_start": 506,
"char_end": 510,
"chars": "'%s'"
},
{
"char_start": 523,
"char_end": 527,
... | github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922 | docker/app.py | cwe-089 |
reportMatch._checkPairing | def _checkPairing():
if winner == loser:
raise ValueError('Attempt to match player against self')
q = '''
SELECT COUNT(*) FROM matches
WHERE (matches.winner_id = %s AND matches.loser_id = %s)
OR (matches.winner_id = %s AND matches.loser_id = %s);
''... | def _checkPairing():
if winner == loser:
raise ValueError('Attempt to match player against self')
q = '''
SELECT COUNT(*) FROM matches
WHERE (matches.winner_id = %s AND matches.loser_id = %s)
OR (matches.winner_id = %s AND matches.loser_id = %s);
''... | {
"deleted": [
{
"line_no": 9,
"char_start": 310,
"char_end": 355,
"line": " ''' % (winner, loser, loser, winner)\n"
},
{
"line_no": 10,
"char_start": 355,
"char_end": 378,
"line": " cur.execute(q)\n"
}
],
"added": [
{
"line_n... | {
"deleted": [
{
"char_start": 322,
"char_end": 323,
"chars": "%"
},
{
"char_start": 354,
"char_end": 376,
"chars": "\n cur.execute(q"
}
],
"added": [
{
"char_start": 321,
"char_end": 327,
"chars": "\n "
},
{
"char_... | github.com/juanchopanza/Tournament/commit/5799aee52d2cabb685800b88977257bd0964d0da | vagrant/tournament/tournament.py | cwe-089 |
add_month_data_row | def add_month_data_row(self, inverter_serial, ts, etoday, etotal):
y = datetime.fromtimestamp(ts) - timedelta(days=1)
y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())
query = '''
INSERT INTO MonthData (
TimeStamp,
Ser... | def add_month_data_row(self, inverter_serial, ts, etoday, etotal):
y = datetime.fromtimestamp(ts) - timedelta(days=1)
y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())
query = '''
INSERT INTO MonthData (
TimeStamp,
Ser... | {
"deleted": [
{
"line_no": 13,
"char_start": 434,
"char_end": 454,
"line": " %s,\n"
},
{
"line_no": 14,
"char_start": 454,
"char_end": 474,
"line": " %s,\n"
},
{
"line_no": 15,
"char_start": 474,
"char... | {
"deleted": [
{
"char_start": 450,
"char_end": 452,
"chars": "%s"
},
{
"char_start": 470,
"char_end": 472,
"chars": "%s"
},
{
"char_start": 490,
"char_end": 492,
"chars": "%s"
},
{
"char_start": 510,
"char_end": 512,
... | github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65 | util/database.py | cwe-089 |
create_playlist | def create_playlist(name, db):
db.execute(
"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);".format(name=name)) | def create_playlist(name, db):
db.execute(
"INSERT INTO playlist (name, video_position) VALUES(%s, 0);", (name,)) | {
"deleted": [
{
"line_no": 3,
"char_start": 47,
"char_end": 140,
"line": " \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 47,
"char_end": 125,
"line": " ... | {
"deleted": [
{
"char_start": 107,
"char_end": 115,
"chars": "'{name}'"
},
{
"char_start": 121,
"char_end": 128,
"chars": ".format"
},
{
"char_start": 133,
"char_end": 138,
"chars": "=name"
}
],
"added": [
{
"char_start": 107... | github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6 | playlist/playlist_repository.py | cwe-089 |
karma_ask | def karma_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute(
''' SELECT karma FROM people WHERE name='{}' '''.format(name))
karma = cursor.fetchone()
if karma is None:
logger.debug('No karma found for name {}'.format(name))
db.c... | def karma_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute(''' SELECT karma FROM people WHERE name=%(name)s ''',
(name, ))
karma = cursor.fetchone()
if karma is None:
logger.debug('No karma found for name {}'.format(name))
... | {
"deleted": [
{
"line_no": 5,
"char_start": 77,
"char_end": 101,
"line": " cursor.execute(\n"
},
{
"line_no": 6,
"char_start": 101,
"char_end": 176,
"line": " ''' SELECT karma FROM people WHERE name='{}' '''.format(name))\n"
}
],
"... | {
"deleted": [
{
"char_start": 100,
"char_end": 113,
"chars": "\n "
},
{
"char_start": 153,
"char_end": 157,
"chars": "'{}'"
},
{
"char_start": 161,
"char_end": 168,
"chars": ".format"
}
],
"added": [
{
"char_start"... | github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a | KarmaBoi/dbopts.py | cwe-089 |
post | def post(self):
""" Returns JWT upon login verification """
json_data = request.get_json()
if not json_data['email']:
return jsonify({"msg": "Missing email"}), 400
data = database_utilities.execute_query(
f"""select * from admins where email = '{json_data['em... | def post(self):
""" Returns JWT upon login verification """
json_data = request.get_json()
if not json_data['email']:
return jsonify({"msg": "Missing email"}), 400
data = database_utilities.execute_query(
f"""select * from admins where email = %s""", (json_da... | {
"deleted": [
{
"line_no": 8,
"char_start": 254,
"char_end": 332,
"line": " f\"\"\"select * from admins where email = '{json_data['email']}'\"\"\")\n"
}
],
"added": [
{
"line_no": 8,
"char_start": 254,
"char_end": 336,
"line": " f\... | {
"deleted": [
{
"char_start": 305,
"char_end": 307,
"chars": "'{"
},
{
"char_start": 325,
"char_end": 330,
"chars": "}'\"\"\""
}
],
"added": [
{
"char_start": 305,
"char_end": 313,
"chars": "%s\"\"\", ("
},
{
"char_start": 33... | github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485 | apis/login.py | cwe-089 |
add_day_data_row | def add_day_data_row(self, ts, data, prev_etotal):
if data['power'] > 0:
inv_serial = data['source']['serial_id']
query = '''
INSERT INTO DayData (
TimeStamp,
Serial,
Power,
TotalYield
... | def add_day_data_row(self, ts, data, prev_etotal):
if data['power'] > 0:
inv_serial = data['source']['serial_id']
query = '''
INSERT INTO DayData (
TimeStamp,
Serial,
Power,
TotalYield
... | {
"deleted": [
{
"line_no": 13,
"char_start": 340,
"char_end": 363,
"line": " %s,\n"
},
{
"line_no": 14,
"char_start": 363,
"char_end": 386,
"line": " %s,\n"
},
{
"line_no": 15,
"char_start": 386,
... | {
"deleted": [
{
"char_start": 359,
"char_end": 361,
"chars": "%s"
},
{
"char_start": 382,
"char_end": 384,
"chars": "%s"
},
{
"char_start": 405,
"char_end": 407,
"chars": "%s"
},
{
"char_start": 428,
"char_end": 430,
... | github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65 | util/database.py | cwe-089 |
store_metadata | def store_metadata(self, session, key, mType, value):
if (self.idNormalizer is not None):
id = self.idNormalizer.process_string(session, id)
elif type(id) == unicode:
id = id.encode('utf-8')
else:
id = str(id)
self._openContainer(session)
q... | def store_metadata(self, session, key, mType, value):
if (self.idNormalizer is not None):
id = self.idNormalizer.process_string(session, id)
elif type(id) == unicode:
id = id.encode('utf-8')
else:
id = str(id)
self._openContainer(session)
q... | {
"deleted": [
{
"line_no": 9,
"char_start": 311,
"char_end": 379,
"line": " query = (\"UPDATE %s SET %s = %r WHERE identifier = '%s';\" %\n"
},
{
"line_no": 10,
"char_start": 379,
"char_end": 427,
"line": " (self.table, mType, value, ... | {
"deleted": [
{
"char_start": 348,
"char_end": 350,
"chars": "%r"
},
{
"char_start": 370,
"char_end": 374,
"chars": "'%s'"
},
{
"char_start": 414,
"char_end": 415,
"chars": ","
},
{
"char_start": 416,
"char_end": 422,
... | github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e | cheshire3/sql/postgresStore.py | cwe-089 |
get | def get(self, space_id):
""" Fetch data for space with the corresponding space_id """
return database_utilities.execute_query(
f"""select * from spaces where space_id = '{space_id}'""") | def get(self, space_id):
""" Fetch data for space with the corresponding space_id """
return database_utilities.execute_query(
f"""select * from spaces where space_id = %s""", (space_id, )) | {
"deleted": [
{
"line_no": 4,
"char_start": 147,
"char_end": 217,
"line": " f\"\"\"select * from spaces where space_id = '{space_id}'\"\"\")\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 147,
"char_end": 221,
"line": " f\"\"\"se... | {
"deleted": [
{
"char_start": 201,
"char_end": 203,
"chars": "'{"
},
{
"char_start": 211,
"char_end": 216,
"chars": "}'\"\"\""
}
],
"added": [
{
"char_start": 201,
"char_end": 209,
"chars": "%s\"\"\", ("
},
{
"char_start": 21... | github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485 | apis/spaces.py | cwe-089 |
check | def check(current_num):
try:
cursor.execute('SELECT * FROM comics WHERE num="%s"' % current_num)
except sqlite3.OperationalError:
cursor.execute('CREATE TABLE comics (num text)')
return False
else:
return False if cursor.fetchone() is None else True | def check(current_num):
try:
cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))
except sqlite3.OperationalError:
cursor.execute('CREATE TABLE comics (num text)')
return False
else:
return False if cursor.fetchone() is None else True | {
"deleted": [
{
"line_no": 3,
"char_start": 33,
"char_end": 109,
"line": " cursor.execute('SELECT * FROM comics WHERE num=\"%s\"' % current_num)\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 33,
"char_end": 108,
"line": " cursor.execute... | {
"deleted": [
{
"char_start": 88,
"char_end": 92,
"chars": "\"%s\""
},
{
"char_start": 93,
"char_end": 95,
"chars": " %"
}
],
"added": [
{
"char_start": 88,
"char_end": 89,
"chars": "?"
},
{
"char_start": 90,
"char_end"... | github.com/lord63/a_bunch_of_code/commit/c0d67a1312306fd1257c354bfb5d6cac7643aa29 | comics/check_comics.py | cwe-089 |
delete_crawl | @app.route('/delete_crawl', methods=['POST'])
@is_logged_in
def delete_crawl():
# Get Form Fields
cid = request.form['cid']
# Create cursor
cur = mysql.connection.cursor()
# Get user by username
result = cur.execute("DELETE FROM Crawls WHERE cid = %s" % cid)
#... | @app.route('/delete_crawl', methods=['POST'])
@is_logged_in
def delete_crawl():
# Get Form Fields
cid = request.form['cid']
# Create cursor
cur = mysql.connection.cursor()
# Get user by username
result = cur.execute("""DELETE FROM Crawls WHERE cid = %s""" (cid,))
... | {
"deleted": [
{
"line_no": 12,
"char_start": 238,
"char_end": 310,
"line": " result = cur.execute(\"DELETE FROM Crawls WHERE cid = %s\" % cid)\n"
}
],
"added": [
{
"line_no": 12,
"char_start": 238,
"char_end": 315,
"line": " result = cur.e... | {
"deleted": [
{
"char_start": 303,
"char_end": 305,
"chars": "% "
}
],
"added": [
{
"char_start": 268,
"char_end": 270,
"chars": "\"\""
},
{
"char_start": 304,
"char_end": 306,
"chars": "\"\""
},
{
"char_start": 307,
"c... | github.com/yannvon/table-detection/commit/4bad3673debf0b9491b520f0e22e9186af78c375 | bar.py | cwe-089 |
add_movie | @app.route('/movies/add', methods=['GET', 'POST'])
def add_movie():
form = MovieForm()
if not form.validate_on_submit():
return render_template('new_movie.html', title='Add New Movie', form=form)
lang_id = add_language(form.data['language'])
movie = {
'title': '',
'descri... | @app.route('/movies/add', methods=['GET', 'POST'])
def add_movie():
form = MovieForm()
if not form.validate_on_submit():
return render_template('new_movie.html', title='Add New Movie', form=form)
lang_id = add_language(form.data['language'])
movie = {
'title': '',
'descri... | {
"deleted": [
{
"line_no": 22,
"char_start": 784,
"char_end": 836,
"line": " VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n"
},
{
"line_no": 23,
"char_start": 836,
"char_end": 887,
"line": " \"\"\".format(*[v for k, v in movie.items()])\n"
... | {
"deleted": [
{
"char_start": 800,
"char_end": 804,
"chars": "'{}'"
},
{
"char_start": 806,
"char_end": 810,
"chars": "'{}'"
},
{
"char_start": 812,
"char_end": 814,
"chars": "{}"
},
{
"char_start": 816,
"char_end": 818,
... | github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b | app.py | cwe-089 |
new_category | def new_category(category_name):
try:
conn = check_heroku_db()
cur = conn.cursor()
cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))
conn.commit()
conn.close()
except psycopg2.DatabaseError as e:
print('Error %s' % e)
sys.... | def new_category(category_name):
try:
conn = check_heroku_db()
cur = conn.cursor()
query = "INSERT INTO categories (cat_name) VALUES (%s);"
data = (category_name,)
cur.execute(query, data)
conn.commit()
conn.close()
except psycopg2.DatabaseError as e:
... | {
"deleted": [
{
"line_no": 5,
"char_start": 103,
"char_end": 194,
"line": " cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))\n"
}
],
"added": [
{
"line_no": 5,
"char_start": 103,
"char_end": 104,
"line": "\n"
... | {
"deleted": [
{
"char_start": 111,
"char_end": 112,
"chars": "c"
},
{
"char_start": 114,
"char_end": 126,
"chars": ".execute('''"
},
{
"char_start": 171,
"char_end": 175,
"chars": "''',"
}
],
"added": [
{
"char_start": 103,
... | github.com/leeorb321/expenses/commit/f93c0fa4d30787ef16420bfefc52565b98bc7fcf | db.py | cwe-089 |
get_first_month | def get_first_month(db, scene):
sql = "select date from matches where scene='{}' order by date limit 1;".format(scene)
res = db.exec(sql)
date = res[0][0]
return date | def get_first_month(db, scene):
sql = "select date from matches where scene='{scene}' order by date limit 1;"
args = {'scene': scene}
res = db.exec(sql, args)
date = res[0][0]
return date | {
"deleted": [
{
"line_no": 2,
"char_start": 32,
"char_end": 123,
"line": " sql = \"select date from matches where scene='{}' order by date limit 1;\".format(scene)\n"
},
{
"line_no": 3,
"char_start": 123,
"char_end": 146,
"line": " res = db.exec(sql)\... | {
"deleted": [
{
"char_start": 108,
"char_end": 111,
"chars": ".fo"
},
{
"char_start": 112,
"char_end": 116,
"chars": "mat("
},
{
"char_start": 121,
"char_end": 122,
"chars": ")"
}
],
"added": [
{
"char_start": 82,
"char... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | bracket_utils.py | cwe-089 |
getOptions | def getOptions(poll_name):
conn, c = connectDB()
options_str = queryOne(c, "SELECT options FROM {} WHERE name='{}'".format(CFG("poll_table_name"), poll_name))
if options_str == None:
return None
options = options_str.split(",")
closeDB(conn)
return options | def getOptions(poll_name):
conn, c = connectDB()
req = "SELECT options FROM {} WHERE name=?".format(CFG("poll_table_name"))
options_str = queryOne(c, req, (poll_name,))
if options_str == None:
return None
options = options_str.split(",")
closeDB(conn)
return options | {
"deleted": [
{
"line_no": 3,
"char_start": 53,
"char_end": 167,
"line": " options_str = queryOne(c, \"SELECT options FROM {} WHERE name='{}'\".format(CFG(\"poll_table_name\"), poll_name))\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 53,
"char_end": 13... | {
"deleted": [
{
"char_start": 57,
"char_end": 67,
"chars": "options_st"
},
{
"char_start": 71,
"char_end": 83,
"chars": "queryOne(c, "
},
{
"char_start": 118,
"char_end": 122,
"chars": "'{}'"
}
],
"added": [
{
"char_start": 5... | github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109 | database.py | cwe-089 |
retrieve_last_video_position | def retrieve_last_video_position(playlist_id, db):
db.execute("SELECT max(position) as position from video WHERE playlist_id={playlist_id};".format(
playlist_id=playlist_id))
row = db.fetchone()
return row['position'] | def retrieve_last_video_position(playlist_id, db):
db.execute(
"SELECT max(position) as position from video WHERE playlist_id=%s;", (playlist_id,))
row = db.fetchone()
return row['position'] | {
"deleted": [
{
"line_no": 2,
"char_start": 51,
"char_end": 153,
"line": " db.execute(\"SELECT max(position) as position from video WHERE playlist_id={playlist_id};\".format(\n"
},
{
"line_no": 3,
"char_start": 153,
"char_end": 187,
"line": " play... | {
"deleted": [
{
"char_start": 129,
"char_end": 136,
"chars": "{playli"
},
{
"char_start": 137,
"char_end": 142,
"chars": "t_id}"
},
{
"char_start": 144,
"char_end": 158,
"chars": ".format(\n "
},
{
"char_start": 159,
"c... | github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6 | video/video_repository.py | cwe-089 |
view_page_history | @app.route('/<page_name>/history')
def view_page_history(page_name):
query = db.query("select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = '%s'" % page_name)
page_histories = query.namedresult()
return render_template(
'pa... | @app.route('/<page_name>/history')
def view_page_history(page_name):
query = db.query("select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = $1", page_name)
page_histories = query.namedresult()
return render_template(
'page_... | {
"deleted": [
{
"line_no": 3,
"char_start": 69,
"char_end": 239,
"line": " query = db.query(\"select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = '%s'\" % page_name)\n"
}
],
"added": [
{
"lin... | {
"deleted": [
{
"char_start": 220,
"char_end": 224,
"chars": "'%s'"
},
{
"char_start": 225,
"char_end": 227,
"chars": " %"
}
],
"added": [
{
"char_start": 220,
"char_end": 222,
"chars": "$1"
},
{
"char_start": 223,
"cha... | github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b | server.py | cwe-089 |
add_input | def add_input(self, data):
connection = self.connects()
try:
# The following introduces a deliberate security flaw. See section on SQL injecton below
query = "INSERT INTO crimes (description) VALUES ('{}');".format(
data)
with connection.cursor() a... | def add_input(self, data):
connection = self.connects()
try:
# The following introduces a deliberate security flaw. See section on SQL injecton below
query = "INSERT INTO crimes (description) VALUES (%s);"
with connection.cursor() as cursor:
cursor... | {
"deleted": [
{
"line_no": 5,
"char_start": 182,
"char_end": 260,
"line": " query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(\n"
},
{
"line_no": 6,
"char_start": 260,
"char_end": 282,
"line": " data)\n"
},
... | {
"deleted": [
{
"char_start": 244,
"char_end": 248,
"chars": "'{}'"
},
{
"char_start": 251,
"char_end": 281,
"chars": ".format(\n data)"
}
],
"added": [
{
"char_start": 244,
"char_end": 246,
"chars": "%s"
},
{
... | github.com/JeremiahO/crimemap/commit/c17537fcd7aa4e2a26f7ca5cefaeb356ff646858 | dbhelper.py | cwe-089 |
get_top_author | def get_top_author(top_num):
""" query the top(top_num) popular author
top_num => list of [author, count]
"""
cmd = """SELECT authors.name,author_result.num
FROM authors JOIN
(SELECT SUM(article_result.num) as num,
article_result.aut... | def get_top_author(top_num):
""" query the top(top_num) popular author
top_num => list of [author, count]
"""
cmd = """SELECT authors.name,author_result.num
FROM authors JOIN
(SELECT SUM(article_result.num) as num,
article_result.aut... | {
"deleted": [
{
"line_no": 21,
"char_start": 931,
"char_end": 998,
"line": " ORDER BY num DESC LIMIT {}\"\"\".format(top_num)\r\n"
},
{
"line_no": 22,
"char_start": 998,
"char_end": 1027,
"line": " return execute_query(cmd)\r\n"
}
... | {
"deleted": [
{
"char_start": 975,
"char_end": 977,
"chars": "{}"
},
{
"char_start": 980,
"char_end": 985,
"chars": ".form"
},
{
"char_start": 987,
"char_end": 988,
"chars": "("
},
{
"char_start": 995,
"char_end": 996,
... | github.com/thugasin/udacity-homework-logAnalyzer/commit/506f25f9a1caee7f17034adf7c75e0efbc88082b | logAnalyzerDb.py | cwe-089 |
get_all_referrers | @app.route('/get_all_referrers')
def get_all_referrers():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
... | @app.route('/get_all_referrers')
def get_all_referrers():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
... | {
"deleted": [
{
"line_no": 15,
"char_start": 430,
"char_end": 500,
"line": " query = \"select * from referrers where referrer='\"+account_id+\"'\"\n"
},
{
"line_no": 16,
"char_start": 500,
"char_end": 523,
"line": " cur.execute(query)\n"
}
],
... | {
"deleted": [
{
"char_start": 482,
"char_end": 498,
"chars": "'\"+account_id+\"'"
}
],
"added": [
{
"char_start": 482,
"char_end": 484,
"chars": "%s"
},
{
"char_start": 507,
"char_end": 522,
"chars": ", (account_id,)"
}
]
} | github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60 | api.py | cwe-089 |
add_translationname | def add_translationname(self, trname):
"""Add new translation by item name for an item."""
if self.connection:
for item in self.find_item_name([trname[0], '0']):
self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values ("%s", "%s", "%s... | def add_translationname(self, trname):
"""Add new translation by item name for an item."""
if self.connection:
for item in self.find_item_name([trname[0], '0']):
t = (item[0], trname[1], trname[2], )
self.cursor.execute('insert into itemtranslation (itemid... | {
"deleted": [
{
"line_no": 5,
"char_start": 194,
"char_end": 359,
"line": " self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")' % (item[0], trname[1], trname[2]))\n"
}
],
"added": [
{
"lin... | {
"deleted": [
{
"char_start": 305,
"char_end": 309,
"chars": "\"%s\""
},
{
"char_start": 311,
"char_end": 315,
"chars": "\"%s\""
},
{
"char_start": 317,
"char_end": 321,
"chars": "\"%s\""
},
{
"char_start": 323,
"char_end":... | github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a | ecosldb/ecosldb.py | cwe-089 |
get_max_task_id_for_project | @staticmethod
def get_max_task_id_for_project(project_id: int):
"""Gets the nights task id currently in use on a project"""
sql = """select max(id) from tasks where project_id = {0} GROUP BY project_id""".format(project_id)
result = db.engine.execute(sql)
if result.rowcount == 0:... | @staticmethod
def get_max_task_id_for_project(project_id: int):
"""Gets the nights task id currently in use on a project"""
sql = """select max(id) from tasks where project_id = :project_id GROUP BY project_id"""
result = db.engine.execute(text(sql), project_id=project_id)
if res... | {
"deleted": [
{
"line_no": 4,
"char_start": 140,
"char_end": 248,
"line": " sql = \"\"\"select max(id) from tasks where project_id = {0} GROUP BY project_id\"\"\".format(project_id)\n"
},
{
"line_no": 5,
"char_start": 248,
"char_end": 288,
"line": " ... | {
"deleted": [
{
"char_start": 202,
"char_end": 205,
"chars": "{0}"
},
{
"char_start": 228,
"char_end": 247,
"chars": ".format(project_id)"
}
],
"added": [
{
"char_start": 202,
"char_end": 213,
"chars": ":project_id"
},
{
"cha... | github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a | server/models/postgis/task.py | cwe-089 |
findNPC | def findNPC(race, classe, sex,level):
c, conn = getConnection()
date = now()
#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;
c.execute("select image, avg(legit) as l FROM npc WHERE race='"+race+"' AND class='"+classe+"' AND... | def findNPC(race, classe, sex,level):
c, conn = getConnection()
date = now()
#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;
c.execute("select image, avg(legit) as l FROM npc WHERE race=(?) AND class=(?) AND sex=(?) GROUP B... | {
"deleted": [
{
"line_no": 5,
"char_start": 221,
"char_end": 391,
"line": "\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race='\"+race+\"' AND class='\"+classe+\"' AND sex='\"+sex+\"' GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC;\")\n"
}
],
"added": [
{
... | {
"deleted": [
{
"char_start": 283,
"char_end": 293,
"chars": "'\"+race+\"'"
},
{
"char_start": 304,
"char_end": 316,
"chars": "'\"+classe+\"'"
},
{
"char_start": 325,
"char_end": 334,
"chars": "'\"+sex+\"'"
},
{
"char_start": 387... | github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0 | database.py | cwe-089 |
edit | @mod.route('/edit/<int:msg_id>', methods=['GET', 'POST'])
def edit(msg_id):
m = None
if request.method == 'GET':
sql = "SELECT * FROM message where msg_id = %d;" % (msg_id)
cursor.execute(sql)
m = cursor.fetchone()
return render_template('message/edit.html', m=m, msg_id=msg_id)
... | @mod.route('/edit/<int:msg_id>', methods=['GET', 'POST'])
def edit(msg_id):
m = None
if request.method == 'GET':
cursor.execute("SELECT * FROM message where msg_id = %s;", (msg_id,))
m = cursor.fetchone()
return render_template('message/edit.html', m=m, msg_id=msg_id)
if request.met... | {
"deleted": [
{
"line_no": 5,
"char_start": 121,
"char_end": 189,
"line": " sql = \"SELECT * FROM message where msg_id = %d;\" % (msg_id)\n"
},
{
"line_no": 6,
"char_start": 189,
"char_end": 217,
"line": " cursor.execute(sql)\n"
},
{
... | {
"deleted": [
{
"char_start": 130,
"char_end": 135,
"chars": "ql = "
},
{
"char_start": 174,
"char_end": 175,
"chars": "d"
},
{
"char_start": 177,
"char_end": 179,
"chars": " %"
},
{
"char_start": 188,
"char_end": 215,
... | github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9 | flaskr/flaskr/views/message.py | cwe-089 |
add_input | def add_input(self,data):
connection = self.connect()
try:
query = "INSERT INTO crimes (description) VALUES ('{}');".format(data)
with connection.cursor() as cursor:
cursor.execute(query)
connection.commit()
finally:
connec... | def add_input(self,data):
connection = self.connect()
try:
query = "INSERT INTO crimes (description) VALUES (%s);"
with connection.cursor() as cursor:
cursor.execute(query,data)
connection.commit()
finally:
connection.close... | {
"deleted": [
{
"line_no": 5,
"char_start": 80,
"char_end": 163,
"line": " query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n"
},
{
"line_no": 7,
"char_start": 211,
"char_end": 249,
"line": " cursor.execute(... | {
"deleted": [
{
"char_start": 142,
"char_end": 146,
"chars": "'{}'"
},
{
"char_start": 149,
"char_end": 162,
"chars": ".format(data)"
}
],
"added": [
{
"char_start": 142,
"char_end": 144,
"chars": "%s"
},
{
"char_start": 232,... | github.com/sgnab/crime-map-app/commit/209b23bad13594c9cdf18d8788fcba7c8f68d37b | dbhelper.py | cwe-089 |
fetch_resultSet | def fetch_resultSet(self, session, id):
self._openContainer(session)
sid = str(id)
if (self.idNormalizer is not None):
sid = self.idNormalizer.process_string(session, sid)
query = ("SELECT class, data FROM %s WHERE identifier = '%s';" %
(self.table, sid)... | def fetch_resultSet(self, session, id):
self._openContainer(session)
sid = str(id)
if (self.idNormalizer is not None):
sid = self.idNormalizer.process_string(session, sid)
query = ("SELECT class, data FROM %s WHERE identifier = $1;" %
(self.table)
... | {
"deleted": [
{
"line_no": 7,
"char_start": 213,
"char_end": 286,
"line": " query = (\"SELECT class, data FROM %s WHERE identifier = '%s';\" %\n"
},
{
"line_no": 8,
"char_start": 286,
"char_end": 321,
"line": " (self.table, sid)\n"
... | {
"deleted": [
{
"char_start": 277,
"char_end": 281,
"chars": "'%s'"
},
{
"char_start": 314,
"char_end": 319,
"chars": ", sid"
},
{
"char_start": 1338,
"char_end": 1342,
"chars": "'%s'"
},
{
"char_start": 1354,
"char_end": 1... | github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e | cheshire3/sql/resultSetStore.py | cwe-089 |
init_user | def init_user(username, chat_id):
conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\users\\" + username + '.db')
conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\cf.db')
cursor = conn.cursor()
cursor2 = conn2.cursor()
cursor.execute("CREATE TABLE result (p... | def init_user(username, chat_id):
conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\users\\" + username + '.db')
conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\cf.db')
cursor = conn.cursor()
cursor2 = conn2.cursor()
cursor.execute("CREATE TABLE result (p... | {
"deleted": [
{
"line_no": 22,
"char_start": 893,
"char_end": 894,
"line": "\n"
},
{
"line_no": 23,
"char_start": 894,
"char_end": 907,
"line": " old = \"\"\n"
},
{
"line_no": 44,
"char_start": 1799,
"char_end": 1914,
"lin... | {
"deleted": [
{
"char_start": 893,
"char_end": 907,
"chars": "\n old = \"\"\n"
},
{
"char_start": 1872,
"char_end": 1883,
"chars": "'\" + s[3] +"
},
{
"char_start": 1884,
"char_end": 1886,
"chars": "\"'"
},
{
"char_start": 189... | github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90 | bases/createuserbase.py | cwe-089 |
process_vote | def process_vote(target,action,chan,mask,db,notice,conn):
if ' ' in target:
notice('Invalid nick')
return
try: votes2kick = database.get(db,'channels','votekick','chan',chan)
except: votes2kick = 10
try: votes2ban = database.get(db,'channels','voteban','chan',chan)
except: votes2ba... | def process_vote(target,action,chan,mask,db,notice,conn):
if ' ' in target:
notice('Invalid nick')
return
try: votes2kick = database.get(db,'channels','votekick','chan',chan)
except: votes2kick = 10
try: votes2ban = database.get(db,'channels','voteban','chan',chan)
except: votes2ba... | {
"deleted": [
{
"line_no": 22,
"char_start": 707,
"char_end": 850,
"line": " voters = db.execute(\"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target)).fetchone()\n"
},
{
"line_no": 51,
"char_start": 1781,
... | {
"deleted": [
{
"char_start": 768,
"char_end": 772,
"chars": "'{}'"
},
{
"char_start": 784,
"char_end": 788,
"chars": "'{}'"
},
{
"char_start": 805,
"char_end": 809,
"chars": "'{}'"
},
{
"char_start": 810,
"char_end": 818,
... | github.com/gstack/uguubot/commit/700ff40be84be88964e61f8ae780564e5862460d | plugins/vote.py | cwe-089 |
like | @mod.route('/like/<int:msg_id>', methods=['GET', 'POST'])
def like(msg_id):
if request.method == 'GET':
user_id = session['logged_id']
c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
sql = "INSERT INTO like_msg(msg_id, user_id,c_time) " + \
"VALUES(%d,'%s','%s');" % (ms... | @mod.route('/like/<int:msg_id>', methods=['GET', 'POST'])
def like(msg_id):
if request.method == 'GET':
user_id = session['logged_id']
c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
cursor.execute("INSERT INTO like_msg(msg_id, user_id,c_time) VALUES(%s,%s,%s);", (msg_id, user_id, c_ti... | {
"deleted": [
{
"line_no": 6,
"char_start": 209,
"char_end": 275,
"line": " sql = \"INSERT INTO like_msg(msg_id, user_id,c_time) \" + \\\n"
},
{
"line_no": 7,
"char_start": 275,
"char_end": 343,
"line": " \"VALUES(%d,'%s','%s');\" % (m... | {
"deleted": [
{
"char_start": 218,
"char_end": 223,
"chars": "ql = "
},
{
"char_start": 269,
"char_end": 292,
"chars": "\" + \\\n \""
},
{
"char_start": 300,
"char_end": 301,
"chars": "d"
},
{
"char_start": 302,
... | github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9 | flaskr/flaskr/views/like_msg.py | cwe-089 |
tag_to_tag_num | def tag_to_tag_num(self, tag):
''' Returns tag_num given tag. '''
q = "SELECT rowid FROM tags WHERE tag = '" + tag + "'"
self.query(q)
return self.c.fetchone()[0] | def tag_to_tag_num(self, tag):
''' Returns tag_num given tag. '''
q = "SELECT rowid FROM tags WHERE tag = ?"
self.query(q, tag)
return self.c.fetchone()[0] | {
"deleted": [
{
"line_no": 4,
"char_start": 79,
"char_end": 142,
"line": " q = \"SELECT rowid FROM tags WHERE tag = '\" + tag + \"'\"\n"
},
{
"line_no": 5,
"char_start": 142,
"char_end": 164,
"line": " self.query(q)\n"
}
],
"added": [
... | {
"deleted": [
{
"char_start": 127,
"char_end": 140,
"chars": "'\" + tag + \"'"
}
],
"added": [
{
"char_start": 127,
"char_end": 128,
"chars": "?"
},
{
"char_start": 150,
"char_end": 155,
"chars": ", tag"
}
]
} | github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b | modules/query_lastfm.py | cwe-089 |
update_history_and_sourcebyinstitution | def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):
"""
Get all current sources and title numbers from Solr and log them into database.
"""
current_sources = get_all_current_sources(k10plus, ai)
current_institutions = get_all_current_institutions(k10plus, ai)
old_sourcebyinsti... | def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):
"""
Get all current sources and title numbers from Solr and log them into database.
"""
current_sources = get_all_current_sources(k10plus, ai)
current_institutions = get_all_current_institutions(k10plus, ai)
old_sourcebyinsti... | {
"deleted": [
{
"line_no": 30,
"char_start": 1094,
"char_end": 1218,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n"
},
{
"line_no": 31,
"char_start": 1218,
"char_end": 1254... | {
"deleted": [
{
"char_start": 1175,
"char_end": 1179,
"chars": "\"%s\""
},
{
"char_start": 1181,
"char_end": 1183,
"chars": "%s"
},
{
"char_start": 1185,
"char_end": 1217,
"chars": " % (sourcebyinstitution, number)"
},
{
"char_st... | github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a | bin/solrcheckup.py | cwe-089 |
change_message | def change_message(self, new_message, logged_user):
update_sql = """
UPDATE Clients
SET message = '{}'
WHERE client_id = '{}'
""".format(new_message, logged_user.get_client_id())
cursor = self.__conn.cursor()
cursor.execute(update_sql)
se... | def change_message(self, new_message, logged_user):
update_sql = """
UPDATE Clients
SET message = ?
WHERE client_id = ?
"""
cursor = self.__conn.cursor()
cursor.execute(update_sql, (new_message, logged_user.get_client_id()))
self.__conn.c... | {
"deleted": [
{
"line_no": 4,
"char_start": 108,
"char_end": 139,
"line": " SET message = '{}'\n"
},
{
"line_no": 5,
"char_start": 139,
"char_end": 174,
"line": " WHERE client_id = '{}'\n"
},
{
"line_no": 6,
"char_s... | {
"deleted": [
{
"char_start": 134,
"char_end": 138,
"chars": "'{}'"
},
{
"char_start": 169,
"char_end": 173,
"chars": "'{}'"
},
{
"char_start": 185,
"char_end": 234,
"chars": ".format(new_message, logged_user.get_client_id())"
}
],
"ad... | github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3 | Week_9/sql_manager.py | cwe-089 |
create_event | def create_event(self, title, start_time, time_zone, server_id, description):
sql = """INSERT INTO events (title, start_time, time_zone, server_id, description)
VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')
""".format(title, start_time, time_zone, server_id, description)
... | def create_event(self, title, start_time, time_zone, server_id, description):
sql = """
INSERT INTO events (title, start_time, time_zone, server_id, description)
VALUES (%s, %s, %s, %s, %s)
"""
self.cur.execute(sql, (title, start_time, time_zone, server_id, ... | {
"deleted": [
{
"line_no": 2,
"char_start": 82,
"char_end": 173,
"line": " sql = \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n"
},
{
"line_no": 3,
"char_start": 173,
"char_end": 233,
"line": " VALUE... | {
"deleted": [
{
"char_start": 187,
"char_end": 190,
"chars": " "
},
{
"char_start": 198,
"char_end": 203,
"chars": "'{0}'"
},
{
"char_start": 205,
"char_end": 210,
"chars": "'{1}'"
},
{
"char_start": 212,
"char_end": 217,... | github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799 | db/dbase.py | cwe-089 |
get_login2 | @bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)
def get_login2(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
if bases.createuserbase.check_username(message.text... | @bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)
def get_login2(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
if bases.createuserbase.check_username(message.text... | {
"deleted": [
{
"line_no": 9,
"char_start": 465,
"char_end": 466,
"line": "\n"
},
{
"line_no": 10,
"char_start": 466,
"char_end": 553,
"line": " conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n"
}
],
"added... | {
"deleted": [
{
"char_start": 465,
"char_end": 466,
"chars": "\n"
},
{
"char_start": 520,
"char_end": 521,
"chars": "'"
},
{
"char_start": 522,
"char_end": 524,
"chars": " +"
},
{
"char_start": 545,
"char_end": 551,
"... | github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90 | bot.py | cwe-089 |
get_bracket_graph_data | def get_bracket_graph_data(db, tag):
# First, we have to find out which scenes this player has brackets in
sql = "SELECT DISTINCT scene FROM ranks WHERE player='{}'".format(tag)
scenes = db.exec(sql)
scenes = [s[0] for s in scenes]
bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s... | def get_bracket_graph_data(db, tag):
# First, we have to find out which scenes this player has brackets in
sql = "SELECT DISTINCT scene FROM ranks WHERE player='{tag}'"
args = {'tag': tag}
scenes = db.exec(sql, args)
scenes = [s[0] for s in scenes]
bracket_placings_by_scene = {s: get_bracket_pl... | {
"deleted": [
{
"line_no": 3,
"char_start": 111,
"char_end": 186,
"line": " sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{}'\".format(tag)\n"
},
{
"line_no": 4,
"char_start": 186,
"char_end": 212,
"line": " scenes = db.exec(sql)\n"
}
]... | {
"deleted": [
{
"char_start": 173,
"char_end": 176,
"chars": ".fo"
},
{
"char_start": 177,
"char_end": 178,
"chars": "m"
},
{
"char_start": 179,
"char_end": 181,
"chars": "t("
},
{
"char_start": 184,
"char_end": 185,
... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | bracket_utils.py | cwe-089 |
get | def get(self, email):
""" Fetch data for admin with the corresponding email """
return database_utilities.execute_query(f"""select * from admins where email = '{email}'""") | def get(self, email):
""" Fetch data for admin with the corresponding email """
return database_utilities.execute_query(f"""select * from admins where email = %s""", (email, )) | {
"deleted": [
{
"line_no": 3,
"char_start": 92,
"char_end": 192,
"line": " return database_utilities.execute_query(f\"\"\"select * from admins where email = '{email}'\"\"\")\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 92,
"char_end": 196,
"l... | {
"deleted": [
{
"char_start": 179,
"char_end": 181,
"chars": "'{"
},
{
"char_start": 186,
"char_end": 191,
"chars": "}'\"\"\""
}
],
"added": [
{
"char_start": 179,
"char_end": 187,
"chars": "%s\"\"\", ("
},
{
"char_start": 19... | github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485 | apis/admins.py | cwe-089 |
insertUsage | def insertUsage(user, command):
c, conn = getConnection()
date = now()
c.execute("INSERT INTO usage (date,user,command) VALUES ('"+date+"','"+str(user)+"','"+command+"')")
conn.commit()
conn.close() | def insertUsage(user, command):
c, conn = getConnection()
date = now()
c.execute("INSERT INTO usage (date,user,command) VALUES (?,?,?)",(date,str(user),command))
conn.commit()
conn.close() | {
"deleted": [
{
"line_no": 4,
"char_start": 73,
"char_end": 175,
"line": "\tc.execute(\"INSERT INTO usage (date,user,command) VALUES ('\"+date+\"','\"+str(user)+\"','\"+command+\"')\")\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 73,
"char_end": 165,
... | {
"deleted": [
{
"char_start": 131,
"char_end": 132,
"chars": "'"
},
{
"char_start": 133,
"char_end": 134,
"chars": "+"
},
{
"char_start": 138,
"char_end": 141,
"chars": "+\"'"
},
{
"char_start": 142,
"char_end": 145,
... | github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0 | database.py | cwe-089 |
verify_email | def verify_email(self, member):
query = "SELECT COUNT(email) FROM members WHERE email = '{email}'".format(email = member)
self.cursor.execute(query)
result = self.cursor.fetchone()
if (int(result[0]) > 0):
return True
else:
return False | def verify_email(self, member):
self.cursor.execute("SELECT COUNT(email) FROM members WHERE email = ':email'", {'email':member})
result = self.cursor.fetchone()
if (int(result[0]) > 0):
return True
else:
return False | {
"deleted": [
{
"line_no": 2,
"char_start": 36,
"char_end": 134,
"line": " query = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email = member)\n"
},
{
"line_no": 3,
"char_start": 134,
"char_end": 169,
"line": " self.cur... | {
"deleted": [
{
"char_start": 44,
"char_end": 46,
"chars": "qu"
},
{
"char_start": 48,
"char_end": 52,
"chars": "y = "
},
{
"char_start": 101,
"char_end": 102,
"chars": "{"
},
{
"char_start": 107,
"char_end": 108,
"ch... | github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb | book_rides/book_rides.py | cwe-089 |
get_previous_yields | def get_previous_yields(self, inverter_serial):
query = '''
SELECT TimeStamp, EToday, ETotal
FROM Inverters
WHERE Serial = '%s'
''' % (inverter_serial)
self.c.execute(query)
data = self.c.fetchone()
return data[0], data[1], data[2] | def get_previous_yields(self, inverter_serial):
query = '''
SELECT TimeStamp, EToday, ETotal
FROM Inverters
WHERE Serial=?
'''
self.c.execute(query, (inverter_serial,))
data = self.c.fetchone()
return data[0], data[1], data[2] | {
"deleted": [
{
"line_no": 5,
"char_start": 142,
"char_end": 173,
"line": " WHERE Serial = '%s'\n"
},
{
"line_no": 6,
"char_start": 173,
"char_end": 205,
"line": " ''' % (inverter_serial)\n"
},
{
"line_no": 7,
"char_star... | {
"deleted": [
{
"char_start": 165,
"char_end": 166,
"chars": " "
},
{
"char_start": 167,
"char_end": 172,
"chars": " '%s'"
},
{
"char_start": 184,
"char_end": 204,
"chars": " % (inverter_serial)"
}
],
"added": [
{
"char_start... | github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65 | util/database.py | cwe-089 |
referrer_count | @app.route('/referrer_count')
def referrer_count():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
acc... | @app.route('/referrer_count')
def referrer_count():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
acc... | {
"deleted": [
{
"line_no": 15,
"char_start": 424,
"char_end": 501,
"line": " query = \"select count(*) from referrers where referrer='\"+account_id+\"'\"\n"
},
{
"line_no": 16,
"char_start": 501,
"char_end": 524,
"line": " cur.execute(query)\n"
}
... | {
"deleted": [
{
"char_start": 483,
"char_end": 499,
"chars": "'\"+account_id+\"'"
}
],
"added": [
{
"char_start": 483,
"char_end": 485,
"chars": "%s"
},
{
"char_start": 508,
"char_end": 523,
"chars": ", (account_id,)"
}
]
} | github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60 | api.py | cwe-089 |
analyze_scene | def analyze_scene(self, scene):
base_urls = scene.get_base_urls()
users = scene.get_users()
name = scene.get_name()
LOG.info('found the following users for scene {}: {}'.format(name, users))
# This scene might have one user who always posts the brackets on their challonge ac... | def analyze_scene(self, scene):
base_urls = scene.get_base_urls()
users = scene.get_users()
name = scene.get_name()
LOG.info('found the following users for scene {}: {}'.format(name, users))
# This scene might have one user who always posts the brackets on their challonge ac... | {
"deleted": [
{
"line_no": 10,
"char_start": 402,
"char_end": 480,
"line": " sql = \"SELECT * FROM user_analyzed WHERE user='{}';\".format(user)\n"
},
{
"line_no": 11,
"char_start": 480,
"char_end": 520,
"line": " results = self.db.exe... | {
"deleted": [
{
"char_start": 466,
"char_end": 469,
"chars": ".fo"
},
{
"char_start": 470,
"char_end": 474,
"chars": "mat("
},
{
"char_start": 478,
"char_end": 479,
"chars": ")"
},
{
"char_start": 1302,
"char_end": 1305,
... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | validURLs.py | cwe-089 |
get_article | def get_article(index):
with conn.cursor(cursor_factory=DictCursor) as cur:
query = "SELECT * FROM articles WHERE index="+str(index)
cur.execute(query)
article = cur.fetchone()
return article | def get_article(index):
with conn.cursor(cursor_factory=DictCursor) as cur:
query = "SELECT * FROM articles WHERE index=%s"
cur.execute(query, (index, ))
article = cur.fetchone()
return article | {
"deleted": [
{
"line_no": 3,
"char_start": 80,
"char_end": 145,
"line": " query = \"SELECT * FROM articles WHERE index=\"+str(index)\n"
},
{
"line_no": 4,
"char_start": 145,
"char_end": 172,
"line": " cur.execute(query)\n"
}
],
"added... | {
"deleted": [
{
"char_start": 132,
"char_end": 134,
"chars": "\"+"
},
{
"char_start": 135,
"char_end": 144,
"chars": "tr(index)"
}
],
"added": [
{
"char_start": 132,
"char_end": 133,
"chars": "%"
},
{
"char_start": 134,
... | github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a | app.py | cwe-089 |
create_cf_base | def create_cf_base():
url = 'http://codeforces.com/problemset/'
r = requests.get(url)
max_page = 0
soup = BeautifulSoup(r.text, "lxml")
base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\cf.db")
conn = base.cursor()
conn.execute("create table problems (problem INTEGER, di... | def create_cf_base():
url = 'http://codeforces.com/problemset/'
r = requests.get(url)
max_page = 0
soup = BeautifulSoup(r.text, "lxml")
base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\cf.db")
conn = base.cursor()
conn.execute("create table problems (problem INTEGER, di... | {
"deleted": [
{
"line_no": 10,
"char_start": 360,
"char_end": 437,
"line": " conn.execute(\"create table \" + i + \" (problems INTEGER, diff CHAR)\")\n"
},
{
"line_no": 37,
"char_start": 1385,
"char_end": 1468,
"line": " conn.execu... | {
"deleted": [
{
"char_start": 395,
"char_end": 404,
"chars": "\" + i + \""
},
{
"char_start": 1431,
"char_end": 1443,
"chars": "\" + s[3] + \""
}
],
"added": [
{
"char_start": 395,
"char_end": 396,
"chars": "?"
},
{
"char_sta... | github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90 | bases/createcfbase.py | cwe-089 |
closeGame | def closeGame(ID):
db.execute("UPDATE games set Running = 'No' WHERE ID = %i" % ID)
database.commit() | def closeGame(ID):
db.execute("UPDATE games set Running = 'No' WHERE ID = ?", ID)
database.commit() | {
"deleted": [
{
"line_no": 2,
"char_start": 19,
"char_end": 85,
"line": "\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = %i\" % ID)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 19,
"char_end": 83,
"line": "\tdb.execute(\"UPDATE games set R... | {
"deleted": [
{
"char_start": 75,
"char_end": 77,
"chars": "%i"
},
{
"char_start": 78,
"char_end": 80,
"chars": " %"
}
],
"added": [
{
"char_start": 75,
"char_end": 76,
"chars": "?"
},
{
"char_start": 77,
"char_end": 78... | github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2 | plugins/database.py | cwe-089 |
cancelFollow | def cancelFollow(self,userid,friendid):
sqlText="delete from friends where userid=%d and friendid=%d;"%(userid,friendid)
result=sql.deleteDB(self.conn,sqlText)
return result; | def cancelFollow(self,userid,friendid):
sqlText="delete from friends where userid=%d and friendid=%s;"
params=[userid,friendid]
result=sql.deleteDB(self.conn,sqlText,params)
return result; | {
"deleted": [
{
"line_no": 2,
"char_start": 44,
"char_end": 133,
"line": " sqlText=\"delete from friends where userid=%d and friendid=%d;\"%(userid,friendid)\n"
},
{
"line_no": 3,
"char_start": 133,
"char_end": 180,
"line": " result=sql.delete... | {
"deleted": [
{
"char_start": 111,
"char_end": 112,
"chars": "d"
},
{
"char_start": 114,
"char_end": 116,
"chars": "%("
},
{
"char_start": 131,
"char_end": 132,
"chars": ")"
}
],
"added": [
{
"char_start": 111,
"char_en... | github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9 | modules/users.py | cwe-089 |
change_pass | def change_pass(self, new_pass, logged_user):
update_sql = """
UPDATE Clients
SET password = '{}'
WHERE client_id = '{}'
""".format(new_pass, logged_user.get_client_id())
cursor = self.__conn.cursor()
cursor.execute(update_sql)
self.__con... | def change_pass(self, new_pass, logged_user):
update_sql = """
UPDATE Clients
SET password = ?
WHERE client_id = ?
"""
cursor = self.__conn.cursor()
cursor.execute(update_sql, (new_pass, logged_user.get_client_id()))
self.__conn.commit() | {
"deleted": [
{
"line_no": 4,
"char_start": 102,
"char_end": 134,
"line": " SET password = '{}'\n"
},
{
"line_no": 5,
"char_start": 134,
"char_end": 169,
"line": " WHERE client_id = '{}'\n"
},
{
"line_no": 6,
"char_... | {
"deleted": [
{
"char_start": 129,
"char_end": 133,
"chars": "'{}'"
},
{
"char_start": 164,
"char_end": 168,
"chars": "'{}'"
},
{
"char_start": 180,
"char_end": 226,
"chars": ".format(new_pass, logged_user.get_client_id())"
}
],
"added... | github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3 | Week_9/sql_manager.py | cwe-089 |
getCommentsByPostid | def getCommentsByPostid(self,postid,userid):
sqlText="select (select Count(*) from comment_like where comments.commentid = comment_like.commentid) as like,(select Count(*) from comment_like where comments.commentid = comment_like.commentid and comment_like.userid=%d) as flag,commentid,name,comment from user... | def getCommentsByPostid(self,postid,userid):
sqlText="select (select Count(*) from comment_like where \
comments.commentid = comment_like.commentid) as like,(select Count(*) \
from comment_like where comments.commentid = \
comment_like.commentid and comment_like.useri... | {
"deleted": [
{
"line_no": 2,
"char_start": 49,
"char_end": 417,
"line": " sqlText=\"select (select Count(*) from comment_like where comments.commentid = comment_like.commentid) as like,(select Count(*) from comment_like where comments.commentid = comment_like.commentid and comment... | {
"deleted": [
{
"char_start": 277,
"char_end": 278,
"chars": "d"
},
{
"char_start": 378,
"char_end": 379,
"chars": "d"
},
{
"char_start": 400,
"char_end": 402,
"chars": "%("
},
{
"char_start": 415,
"char_end": 416,
"c... | github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9 | modules/comment.py | cwe-089 |
__init__.callback | def callback(recipeName):
menu.pack_forget()
viewRecipeFrame.pack(expand=True, fill='both')
groceryButton.pack_forget()
database_file = "meal_planner.db"
print(recipeName)
with sqlite3.connect(database_file) as conn:
cursor ... | def callback(recipeName):
menu.pack_forget()
viewRecipeFrame.pack(expand=True, fill='both')
groceryButton.pack_forget()
database_file = "meal_planner.db"
print(recipeName)
with sqlite3.connect(database_file) as conn:
cursor ... | {
"deleted": [
{
"line_no": 9,
"char_start": 336,
"char_end": 448,
"line": " selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = \"\"\" + \"\\\"\" + recipeName + \"\\\"\")\n"
}
],
"added": [
{
"line_no": 9,
"char_start": 336,
"cha... | {
"deleted": [
{
"char_start": 419,
"char_end": 421,
"chars": " +"
},
{
"char_start": 422,
"char_end": 429,
"chars": "\"\\\"\" + "
},
{
"char_start": 439,
"char_end": 441,
"chars": " +"
},
{
"char_start": 442,
"char_end": 44... | github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925 | mealPlan.py | cwe-089 |
patch | @jwt_required
def patch(self, user_id):
""" Replaces information of corresponding user_id with request body """
query = f"""update users set user_id = %s """
query += f"""where user_id = '{user_id}'"""
json_data = request.get_json()
parameters = (json_data['user_id'], )
... | @jwt_required
def patch(self, user_id):
""" Replaces information of corresponding user_id with request body """
query = f"""update users set user_id = %s """
query += f"""where user_id = %s"""
json_data = request.get_json()
parameters = (json_data['user_id'], user_id)
... | {
"deleted": [
{
"line_no": 5,
"char_start": 182,
"char_end": 234,
"line": " query += f\"\"\"where user_id = '{user_id}'\"\"\"\n"
},
{
"line_no": 7,
"char_start": 273,
"char_end": 319,
"line": " parameters = (json_data['user_id'], )\n"
}
... | {
"deleted": [
{
"char_start": 219,
"char_end": 222,
"chars": "'{u"
},
{
"char_start": 223,
"char_end": 230,
"chars": "er_id}'"
}
],
"added": [
{
"char_start": 219,
"char_end": 220,
"chars": "%"
},
{
"char_start": 308,
"... | github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485 | apis/users.py | cwe-089 |
edit | @mod.route('/edit', methods=['GET', 'POST'])
def edit():
sql = "SELECT * FROM users where email = '%s';" % (session['logged_email'])
cursor.execute(sql)
u = cursor.fetchone()
if request.method == 'POST':
sql = "UPDATE users SET nickname = '%s' where email = '%s'" \
% (request.form['nickn... | @mod.route('/edit', methods=['GET', 'POST'])
def edit():
cursor.execute("SELECT * FROM users where email = %s;", (session['logged_email'],))
u = cursor.fetchone()
if request.method == 'POST':
cursor.execute("UPDATE users SET nickname = %s where email = %s", (request.form['nickname'], session['logged... | {
"deleted": [
{
"line_no": 3,
"char_start": 57,
"char_end": 137,
"line": " sql = \"SELECT * FROM users where email = '%s';\" % (session['logged_email'])\n"
},
{
"line_no": 4,
"char_start": 137,
"char_end": 161,
"line": " cursor.execute(sql)\n"
},
... | {
"deleted": [
{
"char_start": 62,
"char_end": 67,
"chars": "ql = "
},
{
"char_start": 102,
"char_end": 103,
"chars": "'"
},
{
"char_start": 105,
"char_end": 106,
"chars": "'"
},
{
"char_start": 108,
"char_end": 110,
"... | github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9 | flaskr/flaskr/views/users.py | cwe-089 |
shame_add | def shame_add(name):
shame = shame_ask(name)
db = db_connect()
cursor = db.cursor()
if shame is None:
try:
cursor.execute('''
INSERT INTO people(name,karma,shame) VALUES('{}',0,1)
'''.format(name))
db.commit()
logger.debug('Inse... | def shame_add(name):
shame = shame_ask(name)
db = db_connect()
cursor = db.cursor()
if shame is None:
try:
cursor.execute('''
INSERT INTO people(name,karma,shame) VALUES(%(name)s,0,1)
''', (name, ))
db.commit()
logger.debug('Ins... | {
"deleted": [
{
"line_no": 8,
"char_start": 162,
"char_end": 232,
"line": " INSERT INTO people(name,karma,shame) VALUES('{}',0,1)\n"
},
{
"line_no": 9,
"char_start": 232,
"char_end": 266,
"line": " '''.format(name))\n"
},
... | {
"deleted": [
{
"char_start": 222,
"char_end": 226,
"chars": "'{}'"
},
{
"char_start": 251,
"char_end": 258,
"chars": ".format"
},
{
"char_start": 654,
"char_end": 657,
"chars": "{0}"
},
{
"char_start": 671,
"char_end": 676... | github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a | KarmaBoi/dbopts.py | cwe-089 |
can_user_pass_that_amount_of_money | def can_user_pass_that_amount_of_money(self, user_id, money):
self.cursor.execute("SELECT count(id) FROM kickstarter.users where id = %s and money >= %s" % (user_id, money))
return self.cursor.fetchall()[0][0] | def can_user_pass_that_amount_of_money(self, user_id, money):
self.cursor.execute("SELECT count(id) FROM kickstarter.users where id = %s and money >= %s", (user_id, money))
return self.cursor.fetchall()[0][0] | {
"deleted": [
{
"line_no": 2,
"char_start": 66,
"char_end": 186,
"line": " self.cursor.execute(\"SELECT count(id) FROM kickstarter.users where id = %s and money >= %s\" % (user_id, money))\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 66,
"char_end"... | {
"deleted": [
{
"char_start": 165,
"char_end": 167,
"chars": " %"
}
],
"added": [
{
"char_start": 165,
"char_end": 166,
"chars": ","
}
]
} | github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b | backend/transactions/TransactionConnector.py | cwe-089 |
placings | @endpoints.route("/placings")
def placings():
if db == None:
init()
tag = request.args.get('tag', default='christmas mike')
# Get all the urls that this player has participated in
sql = "SELECT * FROM placings WHERE player = '{}'".format(tag)
results = list(db.exec(sql))
results.sort(k... | @endpoints.route("/placings")
def placings():
if db == None:
init()
tag = request.args.get('tag', default='christmas mike')
# Get all the urls that this player has participated in
sql = "SELECT * FROM placings WHERE player = '{tag}'"
args = {'tag': tag}
results = list(db.exec(sql, args... | {
"deleted": [
{
"line_no": 9,
"char_start": 202,
"char_end": 269,
"line": " sql = \"SELECT * FROM placings WHERE player = '{}'\".format(tag)\n"
},
{
"line_no": 10,
"char_start": 269,
"char_end": 302,
"line": " results = list(db.exec(sql))\n"
}
]... | {
"deleted": [
{
"char_start": 256,
"char_end": 259,
"chars": ".fo"
},
{
"char_start": 260,
"char_end": 261,
"chars": "m"
},
{
"char_start": 262,
"char_end": 264,
"chars": "t("
},
{
"char_start": 267,
"char_end": 268,
... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | endpoints.py | cwe-089 |
markTokenUsedExternal | def markTokenUsedExternal(token, optStr=""):
conn, c = connectDB()
req = "UPDATE {} SET \"options_selected\"='{}' WHERE token='{}'".format(CFG("tokens_table_name"), \
optStr, token)
c.execute(req)
closeDB(conn) | def markTokenUsedExternal(token, optStr=""):
conn, c = connectDB()
req = "UPDATE {} SET \"options_selected\"=? WHERE token=?".format(CFG("tokens_table_name"))
c.execute(req, (optStr, token,))
closeDB(conn) | {
"deleted": [
{
"line_no": 3,
"char_start": 71,
"char_end": 175,
"line": " req = \"UPDATE {} SET \\\"options_selected\\\"='{}' WHERE token='{}'\".format(CFG(\"tokens_table_name\"), \\\n"
},
{
"line_no": 4,
"char_start": 175,
"char_end": 210,
"line": " ... | {
"deleted": [
{
"char_start": 117,
"char_end": 121,
"chars": "'{}'"
},
{
"char_start": 134,
"char_end": 138,
"chars": "'{}'"
},
{
"char_start": 171,
"char_end": 174,
"chars": ", \\"
},
{
"char_start": 175,
"char_end": 177,
... | github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109 | database.py | cwe-089 |
get_roster | def get_roster(self, server_id):
sql = """SELECT username, role
FROM roles
WHERE roles.server_id = {0};
""".format(server_id)
self.cur.execute(sql)
return self.cur.fetchall() | def get_roster(self, server_id):
sql = """
SELECT username, role
FROM roles
WHERE roles.server_id = %s;
"""
self.cur.execute(sql, (server_id,))
return self.cur.fetchall() | {
"deleted": [
{
"line_no": 2,
"char_start": 37,
"char_end": 76,
"line": " sql = \"\"\"SELECT username, role\n"
},
{
"line_no": 3,
"char_start": 76,
"char_end": 104,
"line": " FROM roles\n"
},
{
"line_no": 4,
"char_... | {
"deleted": [
{
"char_start": 76,
"char_end": 77,
"chars": " "
},
{
"char_start": 91,
"char_end": 93,
"chars": " "
},
{
"char_start": 104,
"char_end": 107,
"chars": " "
},
{
"char_start": 145,
"char_end": 148,
"cha... | github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799 | db/dbase.py | cwe-089 |
retrieve_video | def retrieve_video(id, playlist_id, db):
db.execute("SELECT id, position from video WHERE id={id} and playlist_id={playlist_id};".format(
id=id, playlist_id=playlist_id))
row = db.fetchone()
return row | def retrieve_video(id, playlist_id, db):
db.execute(
"SELECT id, position from video WHERE id=%s and playlist_id=%s;", (id, playlist_id))
row = db.fetchone()
return row | {
"deleted": [
{
"line_no": 2,
"char_start": 41,
"char_end": 142,
"line": " db.execute(\"SELECT id, position from video WHERE id={id} and playlist_id={playlist_id};\".format(\n"
},
{
"line_no": 3,
"char_start": 142,
"char_end": 183,
"line": " id=id... | {
"deleted": [
{
"char_start": 97,
"char_end": 101,
"chars": "{id}"
},
{
"char_start": 118,
"char_end": 125,
"chars": "{playli"
},
{
"char_start": 126,
"char_end": 131,
"chars": "t_id}"
},
{
"char_start": 133,
"char_end": 14... | github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6 | video/video_repository.py | cwe-089 |
followFriends | def followFriends(self,userid,friendid):
sqlText="insert into friends values(%d,%d);"%(friendid,userid)
result=sql.insertDB(self.conn,sqlText)
return result; | def followFriends(self,userid,friendid):
sqlText="insert into friends values(%s,%s);"
params=[friendid,userid]
result=sql.insertDB(self.conn,sqlText,params)
return result; | {
"deleted": [
{
"line_no": 2,
"char_start": 45,
"char_end": 116,
"line": " sqlText=\"insert into friends values(%d,%d);\"%(friendid,userid)\n"
},
{
"line_no": 3,
"char_start": 116,
"char_end": 163,
"line": " result=sql.insertDB(self.conn,sqlTe... | {
"deleted": [
{
"char_start": 90,
"char_end": 91,
"chars": "d"
},
{
"char_start": 93,
"char_end": 94,
"chars": "d"
},
{
"char_start": 97,
"char_end": 99,
"chars": "%("
},
{
"char_start": 114,
"char_end": 115,
"chars":... | github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9 | modules/users.py | cwe-089 |
getGameID | def getGameID(ID):
db.execute("SELECT * FROM games WHERE ID = %i" % ID)
ID = db.fetchone()
return ID | def getGameID(ID):
db.execute("SELECT * FROM games WHERE ID = ?", ID)
ID = db.fetchone()
return ID | {
"deleted": [
{
"line_no": 2,
"char_start": 19,
"char_end": 73,
"line": "\tdb.execute(\"SELECT * FROM games WHERE ID = %i\" % ID)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 19,
"char_end": 71,
"line": "\tdb.execute(\"SELECT * FROM games WHERE ID =... | {
"deleted": [
{
"char_start": 63,
"char_end": 65,
"chars": "%i"
},
{
"char_start": 66,
"char_end": 68,
"chars": " %"
}
],
"added": [
{
"char_start": 63,
"char_end": 64,
"chars": "?"
},
{
"char_start": 65,
"char_end": 66... | github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2 | plugins/database.py | cwe-089 |
top_proxies | @app.route('/top_proxies')
def top_proxies():
con = psycopg2.connect(**config.POSTGRES)
cur = con.cursor()
query = "SELECT sum(amount) FROM holders"
cur.execute(query)
total = cur.fetchone()
total_votes = total[0]
query = "SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by vot... | @app.route('/top_proxies')
def top_proxies():
con = psycopg2.connect(**config.POSTGRES)
cur = con.cursor()
query = "SELECT sum(amount) FROM holders"
cur.execute(query)
total = cur.fetchone()
total_votes = total[0]
query = "SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by vot... | {
"deleted": [
{
"line_no": 25,
"char_start": 551,
"char_end": 650,
"line": " query = \"SELECT account_name, amount FROM holders WHERE account_id='\"+proxy_id+\"' LIMIT 1\"\n"
},
{
"line_no": 26,
"char_start": 650,
"char_end": 677,
"line": " cu... | {
"deleted": [
{
"char_start": 626,
"char_end": 640,
"chars": "'\"+proxy_id+\"'"
},
{
"char_start": 982,
"char_end": 996,
"chars": "'\"+proxy_id+\"'"
}
],
"added": [
{
"char_start": 626,
"char_end": 628,
"chars": "%s"
},
{
"ch... | github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60 | api.py | cwe-089 |
userLogin | def userLogin(self):
sqlName="select count(*) from users where name='%s' and \
password='%s';"%(self.name,self.password)
checkName=sql.queryDB(self.conn,sqlName)
result=checkName[0][0]
if result == 0:
self.clean()
return False
else:
... | def userLogin(self):
sqlName="select count(*) from users where name=%s and password=%s;"
params = [self.name,self.password]
checkName=sql.queryDB(self.conn,sqlName,params)
result=checkName[0][0]
if result == 0:
self.clean()
return False
else:
... | {
"deleted": [
{
"line_no": 3,
"char_start": 26,
"char_end": 92,
"line": " sqlName=\"select count(*) from users where name='%s' and \\\n"
},
{
"line_no": 4,
"char_start": 92,
"char_end": 150,
"line": " password='%s';\"%(self.name,self.p... | {
"deleted": [
{
"char_start": 81,
"char_end": 82,
"chars": "'"
},
{
"char_start": 84,
"char_end": 85,
"chars": "'"
},
{
"char_start": 90,
"char_end": 91,
"chars": "\\"
},
{
"char_start": 92,
"char_end": 100,
"chars": ... | github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9 | modules/users.py | cwe-089 |
search_pages | @app.route("/search", methods = ["POST"])
def search_pages():
search = request.form.get("search")
page = db.query("select title from page where title = '%s'" % search).namedresult()
if len(page) == 0:
return redirect("/%s" % search)
else:
return place_holder(search) | @app.route("/search", methods = ["POST"])
def search_pages():
search = request.form.get("search")
page = db.query("select title from page where title = $1", search).namedresult()
if len(page) == 0:
return redirect("/%s" % search)
else:
return place_holder(search) | {
"deleted": [
{
"line_no": 4,
"char_start": 102,
"char_end": 190,
"line": " page = db.query(\"select title from page where title = '%s'\" % search).namedresult()\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 102,
"char_end": 187,
"line": " page... | {
"deleted": [
{
"char_start": 160,
"char_end": 164,
"chars": "'%s'"
},
{
"char_start": 165,
"char_end": 167,
"chars": " %"
}
],
"added": [
{
"char_start": 160,
"char_end": 162,
"chars": "$1"
},
{
"char_start": 163,
"cha... | github.com/jcortes0309/wiki_flask/commit/a6bf5316abe2eb528adf36c8241a013fd02c5ffa | server.py | cwe-089 |
get_articles_by_subject | def get_articles_by_subject(subject):
with conn.cursor(cursor_factory=DictCursor) as cur:
query = "SELECT * FROM articles WHERE subject='" + subject + "' ORDER BY last_submitted DESC"
cur.execute(query)
articles = cur.fetchall()
return articles | def get_articles_by_subject(subject):
with conn.cursor(cursor_factory=DictCursor) as cur:
query = "SELECT * FROM articles WHERE subject=%s ORDER BY last_submitted DESC"
cur.execute(query, (subject,))
articles = cur.fetchall()
return articles | {
"deleted": [
{
"line_no": 3,
"char_start": 94,
"char_end": 196,
"line": " query = \"SELECT * FROM articles WHERE subject='\" + subject + \"' ORDER BY last_submitted DESC\"\n"
},
{
"line_no": 4,
"char_start": 196,
"char_end": 223,
"line": " cu... | {
"deleted": [
{
"char_start": 148,
"char_end": 153,
"chars": "'\" + "
},
{
"char_start": 154,
"char_end": 165,
"chars": "ubject + \"'"
}
],
"added": [
{
"char_start": 148,
"char_end": 149,
"chars": "%"
},
{
"char_start": 206,... | github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a | app.py | cwe-089 |
getQueue | def getQueue(self, numberOfLinks=10):
self.cursor.execute("SELECT url FROM queue WHERE visited = '0' LIMIT {};".format(numberOfLinks))
result = self.cursor.fetchall()
self.remove(result)
return result | def getQueue(self, numberOfLinks=10):
self.cursor.execute("SELECT url FROM queue WHERE visited = '0' LIMIT ?;", numberOfLinks)
result = self.cursor.fetchall()
self.remove(result)
return result | {
"deleted": [
{
"line_no": 2,
"char_start": 42,
"char_end": 147,
"line": " self.cursor.execute(\"SELECT url FROM queue WHERE visited = '0' LIMIT {};\".format(numberOfLinks))\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 42,
"char_end": 139,
"l... | {
"deleted": [
{
"char_start": 119,
"char_end": 121,
"chars": "{}"
},
{
"char_start": 123,
"char_end": 131,
"chars": ".format("
},
{
"char_start": 144,
"char_end": 145,
"chars": ")"
}
],
"added": [
{
"char_start": 119,
"... | github.com/jappe999/WebScraper/commit/46a4e0843aa44d903293637afad53dfcbc37b480 | beta/database.py | cwe-089 |
showPoll | @hook.command(autohelp=False)
def showPoll(pollID, db=None):
"""Shows the answers for a given poll."""
if not db_ready: db_init(db)
if pollID == None:
poll = db.execute("SELECT pollID, question FROM polls WHERE active = 1")
if len(poll) == 0:
reply("There's no poll open.")
... | @hook.command(autohelp=False)
def showPoll(pollID, db=None):
"""Shows the answers for a given poll."""
if not db_ready: db_init(db)
if pollID == None:
poll = db.execute("SELECT pollID, question FROM polls WHERE active = 1")
if len(poll) == 0:
reply("There's no poll open.")
... | {
"deleted": [
{
"line_no": 11,
"char_start": 343,
"char_end": 442,
"line": " poll = db.execute(\"SELECT pollID, question FROM polls WHERE pollID = '{}'\".format(pollID))\n"
},
{
"line_no": 18,
"char_start": 599,
"char_end": 851,
"line": " for (ind... | {
"deleted": [
{
"char_start": 420,
"char_end": 424,
"chars": "'{}'"
},
{
"char_start": 425,
"char_end": 432,
"chars": ".format"
},
{
"char_start": 764,
"char_end": 766,
"chars": "{}"
},
{
"char_start": 831,
"char_end": 838,... | github.com/FrozenPigs/Taigabot/commit/ea9b83a66ae1f0f38a1895f3e8dfa2833d77e3a6 | plugins/poll.py | cwe-089 |
process_ranks | def process_ranks(self, scene, urls, recent_date):
PLAYER1 = 0
PLAYER2 = 1
WINNER = 2
DATE = 3
SCENE = 4
# make sure if we already have calculated ranks for these players at this time, we do not do it again
sql = "SELECT * FROM ranks WHERE scene = '{}' AND da... | def process_ranks(self, scene, urls, recent_date):
PLAYER1 = 0
PLAYER2 = 1
WINNER = 2
DATE = 3
SCENE = 4
# make sure if we already have calculated ranks for these players at this time, we do not do it again
sql = "SELECT * FROM ranks WHERE scene = '{scene}' A... | {
"deleted": [
{
"line_no": 9,
"char_start": 260,
"char_end": 362,
"line": " sql = \"SELECT * FROM ranks WHERE scene = '{}' AND date='{}';\".format(str(scene), recent_date)\n"
},
{
"line_no": 10,
"char_start": 362,
"char_end": 394,
"line": " re... | {
"deleted": [
{
"char_start": 329,
"char_end": 334,
"chars": ".form"
},
{
"char_start": 335,
"char_end": 339,
"chars": "t(st"
},
{
"char_start": 340,
"char_end": 341,
"chars": "("
},
{
"char_start": 346,
"char_end": 347,
... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | process_data.py | cwe-089 |
analyze_smashgg | def analyze_smashgg(self, urls, name):
LOG.info('we are about to analyze scene {} with {} brackets'.format(name, len(urls)))
for url in urls:
# Before we process this URL, check to see if we already have
sql = "SELECT * FROM analyzed where base_url='{}'".format(url)
... | def analyze_smashgg(self, urls, name):
LOG.info('we are about to analyze scene {} with {} brackets'.format(name, len(urls)))
for url in urls:
# Before we process this URL, check to see if we already have
sql = "SELECT * FROM analyzed where base_url='{url}'"
args =... | {
"deleted": [
{
"line_no": 5,
"char_start": 236,
"char_end": 311,
"line": " sql = \"SELECT * FROM analyzed where base_url='{}'\".format(url)\n"
},
{
"line_no": 6,
"char_start": 311,
"char_end": 347,
"line": " res = self.db.exec(sql)\n"... | {
"deleted": [
{
"char_start": 298,
"char_end": 303,
"chars": ".form"
},
{
"char_start": 304,
"char_end": 306,
"chars": "t("
},
{
"char_start": 309,
"char_end": 310,
"chars": ")"
}
],
"added": [
{
"char_start": 295,
"cha... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | validURLs.py | cwe-089 |
test | @mod.route('/test', methods=['GET', 'POST'])
def test():
user_id = session['logged_id']
sql = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' \
% (user_id)
cursor.execute(sql)
m = cursor.fetchall()
print(m) | @mod.route('/test', methods=['GET', 'POST'])
def test():
user_id = session['logged_id']
cursor.execute('SELECT * FROM message where user_id = %s ORDER BY c_time DESC', (user_id,))
m = cursor.fetchall()
print(m) | {
"deleted": [
{
"line_no": 4,
"char_start": 92,
"char_end": 168,
"line": " sql = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' \\\n"
},
{
"line_no": 5,
"char_start": 168,
"char_end": 188,
"line": " % (user_id)\n"
},
{
... | {
"deleted": [
{
"char_start": 97,
"char_end": 102,
"chars": "ql = "
},
{
"char_start": 142,
"char_end": 143,
"chars": "d"
},
{
"char_start": 165,
"char_end": 177,
"chars": " \\\n %"
},
{
"char_start": 187,
"char_end"... | github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9 | flaskr/flaskr/views/message.py | cwe-089 |
get_last_active_users | @staticmethod
def get_last_active_users(limit):
"""
Get from the database a tuple of users who have been recently using
the bot
:param limit: integer that specifies how much users to get
:return: tuple of tuples with users info
"""
log.info('Evaluating las... | @staticmethod
def get_last_active_users(limit):
"""
Get from the database a tuple of users who have been recently using
the bot
:param limit: integer that specifies how much users to get
:return: tuple of tuples with users info
"""
log.info('Evaluating las... | {
"deleted": [
{
"line_no": 23,
"char_start": 976,
"char_end": 1016,
"line": " f'DESC LIMIT {limit}')\n"
},
{
"line_no": 26,
"char_start": 1030,
"char_end": 1075,
"line": " cursor = db.execute_query(query)\n"
}
],
"added": ... | {
"deleted": [
{
"char_start": 1006,
"char_end": 1007,
"chars": "{"
},
{
"char_start": 1012,
"char_end": 1015,
"chars": "}')"
}
],
"added": [
{
"char_start": 1006,
"char_end": 1033,
"chars": "%s')\n\n parameters = "
},
{
... | github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a | photogpsbot/users.py | cwe-089 |
on_save | def on_save(self):
connection = get_connection()
cursor = connection.cursor()
cursor.execute(
f"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values ('{self.ip_address}', '{self.user_agent}', '{self.referrer}', '{self.full_path}', '{self.visit_tim... | def on_save(self):
connection = get_connection()
cursor = connection.cursor()
cursor.execute(
"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values (%s, %s, %s, %s, %s);",
(str(self.ip_address), str(self.user_agent), str(self.referrer)... | {
"deleted": [
{
"line_no": 5,
"char_start": 122,
"char_end": 328,
"line": " f\"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values ('{self.ip_address}', '{self.user_agent}', '{self.referrer}', '{self.full_path}', '{self.visit_time}');\")\n"
... | {
"deleted": [
{
"char_start": 134,
"char_end": 135,
"chars": "f"
},
{
"char_start": 223,
"char_end": 225,
"chars": "'{"
},
{
"char_start": 240,
"char_end": 242,
"chars": "}'"
},
{
"char_start": 244,
"char_end": 246,
"... | github.com/onewyoming/onewyoming/commit/54fc7b076fda2de74eeb55e6b75b28e09ef231c2 | experimental/python/buford/model/visitor.py | cwe-089 |
update_institutions | def update_institutions(conn, sqlite, k10plus, ai):
"""
Update the institution table.
"""
current_institutions = get_all_current_institutions(k10plus, ai)
old_institutions = get_all_old_institutions(conn, sqlite)
# Check if the institution table is allready filled and this is not the first chec... | def update_institutions(conn, sqlite, k10plus, ai):
"""
Update the institution table.
"""
current_institutions = get_all_current_institutions(k10plus, ai)
old_institutions = get_all_old_institutions(conn, sqlite)
# Check if the institution table is allready filled and this is not the first chec... | {
"deleted": [
{
"line_no": 25,
"char_start": 1155,
"char_end": 1249,
"line": " sql = \"INSERT INTO institution (institution) VALUES ('%s')\" % current_institution\n"
},
{
"line_no": 26,
"char_start": 1249,
"char_end": 1281,
"line": " s... | {
"deleted": [
{
"char_start": 1220,
"char_end": 1224,
"chars": "'%s'"
},
{
"char_start": 1226,
"char_end": 1248,
"chars": " % current_institution"
}
],
"added": [
{
"char_start": 1220,
"char_end": 1221,
"chars": "?"
},
{
"cha... | github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a | bin/solrcheckup.py | cwe-089 |
_add_to_db | @staticmethod
def _add_to_db(user):
"""
Adds User object to the database
:param user: User object with info about user
:return: None
"""
query = ("INSERT INTO users (chat_id, first_name, nickname, "
"last_name, language) "
f"VALUE... | @staticmethod
def _add_to_db(user):
"""
Adds User object to the database
:param user: User object with info about user
:return: None
"""
query = ("INSERT INTO users (chat_id, first_name, nickname, "
"last_name, language) "
f"VALUE... | {
"deleted": [
{
"line_no": 10,
"char_start": 296,
"char_end": 362,
"line": " f\"VALUES ({user.chat_id}, '{user.first_name}', \"\n"
},
{
"line_no": 11,
"char_start": 362,
"char_end": 441,
"line": " f\"'{user.nickname}', '{user... | {
"deleted": [
{
"char_start": 323,
"char_end": 324,
"chars": "{"
},
{
"char_start": 336,
"char_end": 337,
"chars": "}"
},
{
"char_start": 339,
"char_end": 341,
"chars": "'{"
},
{
"char_start": 356,
"char_end": 358,
"c... | github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a | photogpsbot/users.py | cwe-089 |
deletePost | def deletePost(self,postid):
sqlText="delete from post where post.postid=%d"%(postid)
result=sql.deleteDB(self.conn,sqlText)
return result; | def deletePost(self,postid):
sqlText="delete from post where post.postid=%s"
params=[postid]
result=sql.deleteDB(self.conn,sqlText,params)
return result; | {
"deleted": [
{
"line_no": 2,
"char_start": 33,
"char_end": 98,
"line": " sqlText=\"delete from post where post.postid=%d\"%(postid)\n"
},
{
"line_no": 3,
"char_start": 98,
"char_end": 145,
"line": " result=sql.deleteDB(self.conn,sqlText)\n"
... | {
"deleted": [
{
"char_start": 86,
"char_end": 87,
"chars": "d"
},
{
"char_start": 88,
"char_end": 90,
"chars": "%("
},
{
"char_start": 96,
"char_end": 97,
"chars": ")"
}
],
"added": [
{
"char_start": 86,
"char_end": 87,... | github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9 | modules/post.py | cwe-089 |
sloka | @app.route('/sloka')
def sloka():
sloka_number = request.args.get('sloka_number')
sloka_number_parts = sloka_number.split('.')
sloka_number_previous = "%s.%s.%d" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1)
sloka_number_next = "%s.%s.%d" % (sloka_number_parts[0], slo... | @app.route('/sloka')
def sloka():
sloka_number = request.args.get('sloka_number')
sloka_number_parts = sloka_number.split('.')
sloka_number_previous = "%s.%s.%d" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1)
sloka_number_next = "%s.%s.%d" % (sloka_number_parts[0], slo... | {
"deleted": [
{
"line_no": 15,
"char_start": 494,
"char_end": 602,
"line": " cur.execute(\"select * from mula where sloka_number = '%s' order by sloka_line;\" % sloka_number)\n"
},
{
"line_no": 18,
"char_start": 638,
"char_end": 738,
"line": " ... | {
"deleted": [
{
"char_start": 559,
"char_end": 563,
"chars": "'%s'"
},
{
"char_start": 585,
"char_end": 587,
"chars": " %"
},
{
"char_start": 703,
"char_end": 707,
"chars": "'%s'"
},
{
"char_start": 721,
"char_end": 723,
... | github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922 | docker/app.py | cwe-089 |
update_title | def update_title(self, title = None):
if (not self.title):
self.title = title
# This will fall to a sql injection
sql = "UPDATE jdk_entries SET title = '" + self.title + "'" + \
"WHERE jdk_entries.id = '" + self.entry_id + "';"
db_execute(sql)
self.update_date_modified()
... | def update_title(self, title = None):
if (not self.title):
self.title = title
quote_tuple = self.title, self.entry_id
# This will fall to a sql injection
sql = "UPDATE jdk_entries SET title = ?" + \
"WHERE jdk_entries.id = ?;"
db_execute(sql, quote_tuple)
self.update_... | {
"deleted": [
{
"line_no": 6,
"char_start": 132,
"char_end": 200,
"line": " sql = \"UPDATE jdk_entries SET title = '\" + self.title + \"'\" + \\\n"
},
{
"line_no": 7,
"char_start": 200,
"char_end": 261,
"line": " \"WHERE jdk_entries.id = '\" + s... | {
"deleted": [
{
"char_start": 174,
"char_end": 194,
"chars": "'\" + self.title + \"'"
},
{
"char_start": 234,
"char_end": 257,
"chars": "'\" + self.entry_id + \"'"
}
],
"added": [
{
"char_start": 95,
"char_end": 140,
"chars": "quote_tuple ... | github.com/peterlebrun/jdk/commit/000238566fbe55ba09676c3d57af04ae207235ae | entry.py | cwe-089 |
add_language | def add_language(self, language):
""""Add new language for item translations."""
if self.connection:
self.cursor.execute('insert into itemlanguage (language) values ("%s")' % language[0])
self.connection.commit() | def add_language(self, language):
""""Add new language for item translations."""
if self.connection:
t = (language[0], )
self.cursor.execute('insert into itemlanguage (language) values (?)', t)
self.connection.commit() | {
"deleted": [
{
"line_no": 4,
"char_start": 121,
"char_end": 220,
"line": " self.cursor.execute('insert into itemlanguage (language) values (\"%s\")' % language[0])\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 121,
"char_end": 153,
"line"... | {
"deleted": [
{
"char_start": 198,
"char_end": 202,
"chars": "\"%s\""
},
{
"char_start": 204,
"char_end": 206,
"chars": " %"
},
{
"char_start": 207,
"char_end": 218,
"chars": "language[0]"
}
],
"added": [
{
"char_start": 133,... | github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a | ecosldb/ecosldb.py | cwe-089 |
AdaptiveThresholdImage | MagickExport Image *AdaptiveThresholdImage(const Image *image,
const size_t width,const size_t height,const ssize_t offset,
ExceptionInfo *exception)
{
#define ThresholdImageTag "Threshold/Image"
CacheView
*image_view,
*threshold_view;
Image
*threshold_image;
MagickBooleanType
status;
M... | MagickExport Image *AdaptiveThresholdImage(const Image *image,
const size_t width,const size_t height,const ssize_t offset,
ExceptionInfo *exception)
{
#define ThresholdImageTag "Threshold/Image"
CacheView
*image_view,
*threshold_view;
Image
*threshold_image;
MagickBooleanType
status;
M... | {
"deleted": [],
"added": [
{
"line_no": 38,
"char_start": 875,
"char_end": 893,
"line": " if (width == 0)\n"
},
{
"line_no": 39,
"char_start": 893,
"char_end": 922,
"line": " return(threshold_image);\n"
}
]
} | {
"deleted": [],
"added": [
{
"char_start": 881,
"char_end": 928,
"chars": "width == 0)\n return(threshold_image);\n if ("
}
]
} | github.com/ImageMagick/ImageMagick6/commit/55e6dc49f1a381d9d511ee2f888fdc3e3c3e3953 | magick/threshold.c | cwe-125 |
SyncExifProfile | MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)
{
#define MaxDirectoryStack 16
#define EXIF_DELIMITER "\n"
#define EXIF_NUM_FORMATS 12
#define TAG_EXIF_OFFSET 0x8769
#define TAG_INTEROP_OFFSET 0xa005
typedef struct _DirectoryInfo
{
unsigned char
*directory;
size_t
entr... | MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)
{
#define MaxDirectoryStack 16
#define EXIF_DELIMITER "\n"
#define EXIF_NUM_FORMATS 12
#define TAG_EXIF_OFFSET 0x8769
#define TAG_INTEROP_OFFSET 0xa005
typedef struct _DirectoryInfo
{
unsigned char
*directory;
size_t
entr... | {
"deleted": [
{
"line_no": 125,
"char_start": 2750,
"char_end": 2792,
"line": " if ((format-1) >= EXIF_NUM_FORMATS)\n"
}
],
"added": [
{
"line_no": 125,
"char_start": 2750,
"char_end": 2810,
"line": " if ((format < 0) || ((format-1) >= EXIF_NU... | {
"deleted": [],
"added": [
{
"char_start": 2767,
"char_end": 2784,
"chars": " < 0) || ((format"
},
{
"char_start": 2807,
"char_end": 2808,
"chars": ")"
}
]
} | github.com/ImageMagick/ImageMagick/commit/a7bb158b7bedd1449a34432feb3a67c8f1873bfa | MagickCore/profile.c | cwe-125 |
ng_pkt | static int ng_pkt(git_pkt **out, const char *line, size_t len)
{
git_pkt_ng *pkt;
const char *ptr;
size_t alloclen;
pkt = git__malloc(sizeof(*pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->ref = NULL;
pkt->type = GIT_PKT_NG;
line += 3; /* skip "ng " */
if (!(ptr = strchr(line, ' ')))
goto out_err;
len = ptr - line... | static int ng_pkt(git_pkt **out, const char *line, size_t len)
{
git_pkt_ng *pkt;
const char *ptr;
size_t alloclen;
pkt = git__malloc(sizeof(*pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->ref = NULL;
pkt->type = GIT_PKT_NG;
if (len < 3)
goto out_err;
line += 3; /* skip "ng " */
len -= 3;
if (!(ptr = memchr(line,... | {
"deleted": [
{
"line_no": 14,
"char_start": 254,
"char_end": 287,
"line": "\tif (!(ptr = strchr(line, ' ')))\n"
},
{
"line_no": 26,
"char_start": 505,
"char_end": 539,
"line": "\tif (!(ptr = strchr(line, '\\n')))\n"
}
],
"added": [
{
"lin... | {
"deleted": [
{
"char_start": 267,
"char_end": 270,
"chars": "str"
},
{
"char_start": 518,
"char_end": 521,
"chars": "str"
}
],
"added": [
{
"char_start": 226,
"char_end": 256,
"chars": "if (len < 3)\n\t\tgoto out_err;\n\t"
},
{
... | github.com/libgit2/libgit2/commit/1f9a8510e1d2f20ed7334eeeddb92c4dd8e7c649 | src/transports/smart_pkt.c | cwe-125 |
lha_read_file_header_1 | lha_read_file_header_1(struct archive_read *a, struct lha *lha)
{
const unsigned char *p;
size_t extdsize;
int i, err, err2;
int namelen, padding;
unsigned char headersum, sum_calculated;
err = ARCHIVE_OK;
if ((p = __archive_read_ahead(a, H1_FIXED_SIZE, NULL)) == NULL)
return (truncated_error(a));
lha->hea... | lha_read_file_header_1(struct archive_read *a, struct lha *lha)
{
const unsigned char *p;
size_t extdsize;
int i, err, err2;
int namelen, padding;
unsigned char headersum, sum_calculated;
err = ARCHIVE_OK;
if ((p = __archive_read_ahead(a, H1_FIXED_SIZE, NULL)) == NULL)
return (truncated_error(a));
lha->hea... | {
"deleted": [],
"added": [
{
"line_no": 53,
"char_start": 1755,
"char_end": 1779,
"line": "\tif (lha->compsize < 0)\n"
},
{
"line_no": 54,
"char_start": 1779,
"char_end": 1830,
"line": "\t\tgoto invalid;\t/* Invalid compressed file size */\n"
},
{... | {
"deleted": [],
"added": [
{
"char_start": 1760,
"char_end": 1836,
"chars": "lha->compsize < 0)\n\t\tgoto invalid;\t/* Invalid compressed file size */\n\n\tif ("
}
]
} | github.com/libarchive/libarchive/commit/98dcbbf0bf4854bf987557e55e55fff7abbf3ea9 | libarchive/archive_read_support_format_lha.c | cwe-125 |
handle_eac3 | static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)
{
AC3HeaderInfo *hdr = NULL;
struct eac3_info *info;
int num_blocks, ret;
if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info))))
return AVERROR(ENOMEM);
info = track->eac3_priv;
if (avpriv_ac3... | static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)
{
AC3HeaderInfo *hdr = NULL;
struct eac3_info *info;
int num_blocks, ret;
if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info))))
return AVERROR(ENOMEM);
info = track->eac3_priv;
if (avpriv_ac3... | {
"deleted": [
{
"line_no": 42,
"char_start": 1457,
"char_end": 1543,
"line": " avpriv_request_sample(track->par, \"Multiple independent substreams\");\n"
}
],
"added": [
{
"line_no": 42,
"char_start": 1457,
"char_end": 1540,
"line": " ... | {
"deleted": [
{
"char_start": 1495,
"char_end": 1500,
"chars": "track"
},
{
"char_start": 1502,
"char_end": 1505,
"chars": "par"
}
],
"added": [
{
"char_start": 1495,
"char_end": 1498,
"chars": "mov"
},
{
"char_start": 1500,
... | github.com/FFmpeg/FFmpeg/commit/95556e27e2c1d56d9e18f5db34d6f756f3011148 | libavformat/movenc.c | cwe-125 |
set_fdc | static void set_fdc(int drive)
{
if (drive >= 0 && drive < N_DRIVE) {
fdc = FDC(drive);
current_drive = drive;
}
if (fdc != 1 && fdc != 0) {
pr_info("bad fdc value\n");
return;
}
set_dor(fdc, ~0, 8);
#if N_FDC > 1
set_dor(1 - fdc, ~8, 0);
#endif
if (FDCS->rawcmd == 2)
reset_fdc_info(1);
if (fd_inb(FD_... | static void set_fdc(int drive)
{
unsigned int new_fdc = fdc;
if (drive >= 0 && drive < N_DRIVE) {
new_fdc = FDC(drive);
current_drive = drive;
}
if (new_fdc >= N_FDC) {
pr_info("bad fdc value\n");
return;
}
fdc = new_fdc;
set_dor(fdc, ~0, 8);
#if N_FDC > 1
set_dor(1 - fdc, ~8, 0);
#endif
if (FDCS->raw... | {
"deleted": [
{
"line_no": 4,
"char_start": 71,
"char_end": 91,
"line": "\t\tfdc = FDC(drive);\n"
},
{
"line_no": 7,
"char_start": 119,
"char_end": 148,
"line": "\tif (fdc != 1 && fdc != 0) {\n"
}
],
"added": [
{
"line_no": 3,
"char_... | {
"deleted": [
{
"char_start": 128,
"char_end": 129,
"chars": "!"
},
{
"char_start": 131,
"char_end": 144,
"chars": "1 && fdc != 0"
}
],
"added": [
{
"char_start": 34,
"char_end": 64,
"chars": "unsigned int new_fdc = fdc;\n\n\t"
},
... | github.com/torvalds/linux/commit/2e90ca68b0d2f5548804f22f0dd61145516171e3 | drivers/block/floppy.c | cwe-125 |
opmov | static int opmov(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
st64 offset = 0;
int mod = 0;
int base = 0;
int rex = 0;
ut64 immediate = 0;
if (op->operands[1].type & OT_CONSTANT) {
if (!op->operands[1].is_good_flag) {
return -1;
}
if (op->operands[1].immediate == -1) {
return -1;
}
immediat... | static int opmov(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
st64 offset = 0;
int mod = 0;
int base = 0;
int rex = 0;
ut64 immediate = 0;
if (op->operands[1].type & OT_CONSTANT) {
if (!op->operands[1].is_good_flag) {
return -1;
}
if (op->operands[1].immediate == -1) {
return -1;
}
immediat... | {
"deleted": [
{
"line_no": 352,
"char_start": 9435,
"char_end": 9493,
"line": "\t\t\tdata[l++] = SEG_REG_PREFIXES[op->operands[1].regs[0]];\n"
},
{
"line_no": 354,
"char_start": 9514,
"char_end": 9561,
"line": "\t\t\tdata[l++] = op->operands[0].reg << 3 | 0... | {
"deleted": [],
"added": [
{
"char_start": 9490,
"char_end": 9494,
"chars": " % 6"
},
{
"char_start": 9533,
"char_end": 9541,
"chars": "(((ut32)"
},
{
"char_start": 9560,
"char_end": 9561,
"chars": ")"
},
{
"char_start": 9566,
... | github.com/radare/radare2/commit/f17bfd9f1da05f30f23a4dd05e9d2363e1406948 | libr/asm/p/asm_x86_nz.c | cwe-125 |
ares_parse_a_reply | int ares_parse_a_reply(const unsigned char *abuf, int alen,
struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, naddrs;
long int len;
int naliases;
const unsigned char *aptr;
char *hostname, *rr_name, *rr_data, **aliases;
struct in_addr *addrs;
stru... | int ares_parse_a_reply(const unsigned char *abuf, int alen,
struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, naddrs;
long int len;
int naliases;
const unsigned char *aptr;
char *hostname, *rr_name, *rr_data, **aliases;
struct in_addr *addrs;
stru... | {
"deleted": [],
"added": [
{
"line_no": 73,
"char_start": 1933,
"char_end": 1972,
"line": " if (aptr + rr_len > abuf + alen)\n"
},
{
"line_no": 74,
"char_start": 1972,
"char_end": 1975,
"line": "\t{\n"
},
{
"line_no": 75,
"char_st... | {
"deleted": [],
"added": [
{
"char_start": 1933,
"char_end": 2033,
"chars": " if (aptr + rr_len > abuf + alen)\n\t{\n\t free(rr_name);\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n"
}
]
} | github.com/resiprocate/resiprocate/commit/d67a9ca6fd06ca65d23e313bdbad1ef4dd3aa0df | rutil/dns/ares/ares_parse_a_reply.c | cwe-125 |
ExtractPostscript | static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,
MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)
{
char
postscript_file[MaxTextExtent];
const MagicInfo
*magic_info;
FILE
*ps_file;
ImageInfo
*clone_info;
Image
*image2;
unsigned char
... | static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,
MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)
{
char
postscript_file[MaxTextExtent];
const MagicInfo
*magic_info;
FILE
*ps_file;
ImageInfo
*clone_info;
Image
*image2;
unsigned char
... | {
"deleted": [
{
"line_no": 52,
"char_start": 1318,
"char_end": 1396,
"line": " (void) CopyMagickMemory(clone_info->magick,magic_info->name,MaxTextExtent);\n"
}
],
"added": [
{
"line_no": 52,
"char_start": 1318,
"char_end": 1387,
"line": " (void) strnc... | {
"deleted": [
{
"char_start": 1327,
"char_end": 1329,
"chars": "Co"
},
{
"char_start": 1330,
"char_end": 1342,
"chars": "yMagickMemor"
}
],
"added": [
{
"char_start": 1327,
"char_end": 1329,
"chars": "st"
},
{
"char_start": 1... | github.com/ImageMagick/ImageMagick/commit/a251039393f423c7858e63cab6aa98d17b8b7a41 | coders/wpg.c | cwe-125 |
usb_get_bos_descriptor | int usb_get_bos_descriptor(struct usb_device *dev)
{
struct device *ddev = &dev->dev;
struct usb_bos_descriptor *bos;
struct usb_dev_cap_header *cap;
unsigned char *buffer;
int length, total_len, num, i;
int ret;
bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);
if (!bos)
return -ENOMEM;
/* Get... | int usb_get_bos_descriptor(struct usb_device *dev)
{
struct device *ddev = &dev->dev;
struct usb_bos_descriptor *bos;
struct usb_dev_cap_header *cap;
unsigned char *buffer;
int length, total_len, num, i;
int ret;
bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);
if (!bos)
return -ENOMEM;
/* Get... | {
"deleted": [
{
"line_no": 55,
"char_start": 1313,
"char_end": 1338,
"line": "\t\tlength = cap->bLength;\n"
},
{
"line_no": 57,
"char_start": 1339,
"char_end": 1365,
"line": "\t\tif (total_len < length)\n"
}
],
"added": [
{
"line_no": 56,
... | {
"deleted": [
{
"char_start": 1318,
"char_end": 1321,
"chars": "gth"
},
{
"char_start": 1322,
"char_end": 1323,
"chars": "="
},
{
"char_start": 1327,
"char_end": 1343,
"chars": "->bLength;\n\n\t\tif"
},
{
"char_start": 1344,
... | github.com/torvalds/linux/commit/1c0edc3633b56000e18d82fc241e3995ca18a69e | drivers/usb/core/config.c | cwe-125 |
Mat_VarReadNextInfo4 | Mat_VarReadNextInfo4(mat_t *mat)
{
int M,O,data_type,class_type;
mat_int32_t tmp;
long nBytes;
size_t readresult;
matvar_t *matvar = NULL;
union {
mat_uint32_t u;
mat_uint8_t c[4];
} endian;
if ( mat == NULL || mat->fp == NULL )
return NULL;
el... | Mat_VarReadNextInfo4(mat_t *mat)
{
int M,O,data_type,class_type;
mat_int32_t tmp;
long nBytes;
size_t readresult;
matvar_t *matvar = NULL;
union {
mat_uint32_t u;
mat_uint8_t c[4];
} endian;
if ( mat == NULL || mat->fp == NULL )
return NULL;
el... | {
"deleted": [],
"added": [
{
"line_no": 155,
"char_start": 3941,
"char_end": 3954,
"line": " } else {\n"
},
{
"line_no": 156,
"char_start": 3954,
"char_end": 3992,
"line": " matvar->name[tmp - 1] = '\\0';\n"
}
]
} | {
"deleted": [],
"added": [
{
"char_start": 3946,
"char_end": 3997,
"chars": " else {\n matvar->name[tmp - 1] = '\\0';\n }"
}
]
} | github.com/tbeu/matio/commit/651a8e28099edb5fbb9e4e1d4d3238848f446c9a | src/mat4.c | cwe-125 |
getToken | static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) {
// Skip whitespace
while (begin && isspace ((ut8)str[*begin])) {
++(*begin);
}
if (!str[*begin]) { // null byte
*end = *begin;
return TT_EOF;
} else if (isalpha ((ut8)str[*begin])) { // word token
*end = *begin... | static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) {
if (*begin > strlen (str)) {
return TT_EOF;
}
// Skip whitespace
while (begin && str[*begin] && isspace ((ut8)str[*begin])) {
++(*begin);
}
if (!str[*begin]) { // null byte
*end = *begin;
return TT_EOF;
}
if (... | {
"deleted": [
{
"line_no": 3,
"char_start": 99,
"char_end": 146,
"line": "\twhile (begin && isspace ((ut8)str[*begin])) {\n"
},
{
"line_no": 10,
"char_start": 247,
"char_end": 305,
"line": "\t} else if (isalpha ((ut8)str[*begin])) { // word token\n"
}... | {
"deleted": [
{
"char_start": 249,
"char_end": 255,
"chars": " else "
},
{
"char_start": 403,
"char_end": 409,
"chars": " else "
}
],
"added": [
{
"char_start": 80,
"char_end": 130,
"chars": "if (*begin > strlen (str)) {\n\t\treturn TT_EOF... | github.com/radare/radare2/commit/66191f780863ea8c66ace4040d0d04a8842e8432 | libr/asm/p/asm_x86_nz.c | cwe-125 |
fiber_switch | fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mrb_bool resume, mrb_bool vmexec)
{
struct mrb_context *c = fiber_check(mrb, self);
struct mrb_context *old_c = mrb->c;
mrb_value value;
fiber_check_cfunc(mrb, c);
if (resume && c->status == MRB_FIBER_TRANSFERRED) {
mrb_raise(m... | fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mrb_bool resume, mrb_bool vmexec)
{
struct mrb_context *c = fiber_check(mrb, self);
struct mrb_context *old_c = mrb->c;
enum mrb_fiber_state status;
mrb_value value;
fiber_check_cfunc(mrb, c);
status = c->status;
if (resume && ... | {
"deleted": [
{
"line_no": 8,
"char_start": 251,
"char_end": 305,
"line": " if (resume && c->status == MRB_FIBER_TRANSFERRED) {\n"
},
{
"line_no": 11,
"char_start": 374,
"char_end": 448,
"line": " if (c->status == MRB_FIBER_RUNNING || c->status == MRB_FIB... | {
"deleted": [
{
"char_start": 267,
"char_end": 270,
"chars": "c->"
},
{
"char_start": 380,
"char_end": 383,
"chars": "c->"
},
{
"char_start": 414,
"char_end": 417,
"chars": "c->"
},
{
"char_start": 516,
"char_end": 519,
... | github.com/mruby/mruby/commit/778500563a9f7ceba996937dc886bd8cde29b42b | mrbgems/mruby-fiber/src/fiber.c | cwe-125 |
start_input_ppm | start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
ppm_source_ptr source = (ppm_source_ptr)sinfo;
int c;
unsigned int w, h, maxval;
boolean need_iobuffer, use_raw_buffer, need_rescale;
if (getc(source->pub.input_file) != 'P')
ERREXIT(cinfo, JERR_PPM_NOT);
c = getc(source->pub.input_file);... | start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
ppm_source_ptr source = (ppm_source_ptr)sinfo;
int c;
unsigned int w, h, maxval;
boolean need_iobuffer, use_raw_buffer, need_rescale;
if (getc(source->pub.input_file) != 'P')
ERREXIT(cinfo, JERR_PPM_NOT);
c = getc(source->pub.input_file);... | {
"deleted": [
{
"line_no": 163,
"char_start": 6187,
"char_end": 6252,
"line": " (size_t)(((long)maxval + 1L) *\n"
}
],
"added": [
{
"line_no": 163,
"char_start": 6187,
"char_end": 6262,
"line": " ... | {
"deleted": [],
"added": [
{
"char_start": 6237,
"char_end": 6241,
"chars": "MAX("
},
{
"char_start": 6247,
"char_end": 6253,
"chars": ", 255)"
}
]
} | github.com/libjpeg-turbo/libjpeg-turbo/commit/3de15e0c344d11d4b90f4a47136467053eb2d09a | rdppm.c | cwe-125 |
snd_usb_create_streams | static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
{
struct usb_device *dev = chip->dev;
struct usb_host_interface *host_iface;
struct usb_interface_descriptor *altsd;
void *control_header;
int i, protocol;
/* find audiocontrol interface */
host_iface = &usb_ifnum_to_if(dev, ctrlif)->alts... | static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
{
struct usb_device *dev = chip->dev;
struct usb_host_interface *host_iface;
struct usb_interface_descriptor *altsd;
void *control_header;
int i, protocol;
int rest_bytes;
/* find audiocontrol interface */
host_iface = &usb_ifnum_to_if(d... | {
"deleted": [],
"added": [
{
"line_no": 8,
"char_start": 235,
"char_end": 252,
"line": "\tint rest_bytes;\n"
},
{
"line_no": 23,
"char_start": 637,
"char_end": 704,
"line": "\trest_bytes = (void *)(host_iface->extra + host_iface->extralen) -\n"
},
... | {
"deleted": [],
"added": [
{
"char_start": 235,
"char_end": 252,
"chars": "\tint rest_bytes;\n"
},
{
"char_start": 638,
"char_end": 872,
"chars": "rest_bytes = (void *)(host_iface->extra + host_iface->extralen) -\n\t\tcontrol_header;\n\n\t/* just to be sure -- this s... | github.com/torvalds/linux/commit/bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991 | sound/usb/card.c | cwe-125 |
process_packet_tail | void process_packet_tail(struct msg_digest *md)
{
struct state *st = md->st;
enum state_kind from_state = md->v1_from_state;
const struct state_v1_microcode *smc = md->smc;
bool new_iv_set = md->new_iv_set;
bool self_delete = FALSE;
if (md->hdr.isa_flags & ISAKMP_FLAGS_v1_ENCRYPTION) {
endpoint_buf b;
dbg("r... | void process_packet_tail(struct msg_digest *md)
{
struct state *st = md->st;
enum state_kind from_state = md->v1_from_state;
const struct state_v1_microcode *smc = md->smc;
bool new_iv_set = md->new_iv_set;
bool self_delete = FALSE;
if (md->hdr.isa_flags & ISAKMP_FLAGS_v1_ENCRYPTION) {
endpoint_buf b;
dbg("r... | {
"deleted": [
{
"line_no": 244,
"char_start": 7553,
"char_end": 7580,
"line": "\t\t\t\t\t\tst->st_state->name);\n"
}
],
"added": [
{
"line_no": 244,
"char_start": 7553,
"char_end": 7593,
"line": "\t\t\t\t\t\tfinite_states[smc->state]->name);\n"
}
... | {
"deleted": [
{
"char_start": 7565,
"char_end": 7568,
"chars": "_st"
}
],
"added": [
{
"char_start": 7559,
"char_end": 7566,
"chars": "finite_"
},
{
"char_start": 7568,
"char_end": 7576,
"chars": "ates[smc"
},
{
"char_start":... | github.com/libreswan/libreswan/commit/471a3e41a449d7c753bc4edbba4239501bb62ba8 | programs/pluto/ikev1.c | cwe-125 |
CSoundFile::GetLength | std::vector<GetLengthType> CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target)
{
std::vector<GetLengthType> results;
GetLengthType retval;
retval.startOrder = target.startOrder;
retval.startRow = target.startRow;
// Are we trying to reach a certain pattern position?
const bool hasSear... | std::vector<GetLengthType> CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target)
{
std::vector<GetLengthType> results;
GetLengthType retval;
retval.startOrder = target.startOrder;
retval.startRow = target.startRow;
// Are we trying to reach a certain pattern position?
const bool hasSear... | {
"deleted": [
{
"line_no": 978,
"char_start": 31995,
"char_end": 32059,
"line": "\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)\n"
}
],
"added": [
{
"line_no": 978,
"char_start": 31995,
"char_end": 32021,
"line": "\t\t\t\tpChn = pla... | {
"deleted": [],
"added": [
{
"char_start": 31999,
"char_end": 32025,
"chars": "pChn = playState.Chn;\n\t\t\t\t"
},
{
"char_start": 32078,
"char_end": 32086,
"chars": "Chn++, p"
}
]
} | github.com/OpenMPT/openmpt/commit/492022c7297ede682161d9c0ec2de15526424e76 | soundlib/Snd_fx.cpp | cwe-125 |
GetPSDRowSize | static inline size_t GetPSDRowSize(Image *image)
{
if (image->depth == 1)
return((image->columns+7)/8);
else
return(image->columns*GetPSDPacketSize(image));
} | static inline size_t GetPSDRowSize(Image *image)
{
if (image->depth == 1)
return(((image->columns+7)/8)*GetPSDPacketSize(image));
else
return(image->columns*GetPSDPacketSize(image));
} | {
"deleted": [
{
"line_no": 4,
"char_start": 76,
"char_end": 110,
"line": " return((image->columns+7)/8);\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 76,
"char_end": 136,
"line": " return(((image->columns+7)/8)*GetPSDPacketSize(image));\n"
... | {
"deleted": [],
"added": [
{
"char_start": 88,
"char_end": 89,
"chars": "("
},
{
"char_start": 108,
"char_end": 133,
"chars": ")*GetPSDPacketSize(image)"
}
]
} | github.com/ImageMagick/ImageMagick/commit/5f16640725b1225e6337c62526e6577f0f88edb8 | coders/psd.c | cwe-125 |
dex_loadcode | static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {
struct r_bin_t *rbin = arch->rbin;
int i;
int *methods = NULL;
int sym_count = 0;
// doublecheck??
if (!bin || bin->methods_list) {
return false;
}
bin->code_from = UT64_MAX;
bin->code_to = 0;
bin->methods_list = r_list_newf ((RListFree)free);
if ... | static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {
struct r_bin_t *rbin = arch->rbin;
int i;
int *methods = NULL;
int sym_count = 0;
// doublecheck??
if (!bin || bin->methods_list) {
return false;
}
bin->code_from = UT64_MAX;
bin->code_to = 0;
bin->methods_list = r_list_newf ((RListFree)free);
if ... | {
"deleted": [
{
"line_no": 75,
"char_start": 1978,
"char_end": 2042,
"line": "\t\t\tif (bin->methods[i].class_id > bin->header.types_size - 1) {\n"
}
],
"added": [
{
"line_no": 75,
"char_start": 1978,
"char_end": 2038,
"line": "\t\t\tif (bin->methods[i]... | {
"deleted": [
{
"char_start": 2034,
"char_end": 2038,
"chars": " - 1"
}
],
"added": []
} | github.com/radare/radare2/commit/ead645853a63bf83d8386702cad0cf23b31d7eeb | libr/bin/p/bin_dex.c | cwe-125 |
ReadSUNImage | static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define RMT_EQUAL_RGB 1
#define RMT_NONE 0
#define RMT_RAW 2
#define RT_STANDARD 1
#define RT_ENCODED 2
#define RT_FORMAT_RGB 3
typedef struct _SUNInfo
{
unsigned int
magic,
width,
height,
depth,
... | static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define RMT_EQUAL_RGB 1
#define RMT_NONE 0
#define RMT_RAW 2
#define RT_STANDARD 1
#define RT_ENCODED 2
#define RT_FORMAT_RGB 3
typedef struct _SUNInfo
{
unsigned int
magic,
width,
height,
depth,
... | {
"deleted": [
{
"line_no": 201,
"char_start": 6237,
"char_end": 6310,
"line": " ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n"
},
{
"line_no": 217,
"char_start": 7201,
"char_end": 7274,
"line": " ThrowReaderException(Resou... | {
"deleted": [
{
"char_start": 6284,
"char_end": 6286,
"chars": "Me"
},
{
"char_start": 6289,
"char_end": 6295,
"chars": "yAlloc"
},
{
"char_start": 6296,
"char_end": 6304,
"chars": "tionFail"
},
{
"char_start": 7248,
"char_... | github.com/ImageMagick/ImageMagick/commit/6b4aff0f117b978502ee5bcd6e753c17aec5a961 | coders/sun.c | cwe-125 |
php_wddx_push_element | */
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* nothing for now */
}
}
... | */
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* nothing for now */
}
}
... | {
"deleted": [],
"added": [
{
"line_no": 71,
"char_start": 1972,
"char_end": 1983,
"line": "\t\t} else {\n"
},
{
"line_no": 72,
"char_start": 1983,
"char_end": 2009,
"line": "\t\t\tent.type = ST_BOOLEAN;\n"
},
{
"line_no": 73,
"char_sta... | {
"deleted": [],
"added": [
{
"char_start": 1975,
"char_end": 2125,
"chars": " else {\n\t\t\tent.type = ST_BOOLEAN;\n\t\t\tSET_STACK_VARNAME;\n\t\t\tZVAL_FALSE(&ent.data);\n\t\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t\t}"
}
]
} | github.com/php/php-src/commit/66fd44209d5ffcb9b3d1bc1b9fd8e35b485040c0 | ext/wddx/wddx.c | cwe-125 |
SMB2_negotiate | SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
{
struct smb_rqst rqst;
struct smb2_negotiate_req *req;
struct smb2_negotiate_rsp *rsp;
struct kvec iov[1];
struct kvec rsp_iov;
int rc = 0;
int resp_buftype;
struct TCP_Server_Info *server = ses->server;
int blob_offset, blob_length;
char *security... | SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
{
struct smb_rqst rqst;
struct smb2_negotiate_req *req;
struct smb2_negotiate_rsp *rsp;
struct kvec iov[1];
struct kvec rsp_iov;
int rc = 0;
int resp_buftype;
struct TCP_Server_Info *server = ses->server;
int blob_offset, blob_length;
char *security... | {
"deleted": [
{
"line_no": 116,
"char_start": 3733,
"char_end": 3799,
"line": "\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))\n"
}
],
"added": [
{
"line_no": 116,
"char_start": 3733,
"char_end": 3771,
"line": "\t\t\tses->server->val... | {
"deleted": [],
"added": [
{
"char_start": 3735,
"char_end": 3773,
"chars": "\tses->server->vals = &smb21_values;\n\t\t"
},
{
"char_start": 3836,
"char_end": 3838,
"chars": " {"
},
{
"char_start": 3880,
"char_end": 3923,
"chars": "\n\t\t\tse... | github.com/torvalds/linux/commit/b57a55e2200ede754e4dc9cce4ba9402544b9365 | fs/cifs/smb2pdu.c | cwe-125 |
parse8BIM | static ssize_t parse8BIM(Image *ifile, Image *ofile)
{
char
brkused,
quoted,
*line,
*token,
*newstr,
*name;
int
state,
next;
unsigned char
dataset;
unsigned int
recnum;
int
inputlen = MaxTextExtent;
MagickOffsetType
savedpos,
currentpos;
ssize_t
... | static ssize_t parse8BIM(Image *ifile, Image *ofile)
{
char
brkused,
quoted,
*line,
*token,
*newstr,
*name;
int
state,
next;
unsigned char
dataset;
unsigned int
recnum;
int
inputlen = MaxTextExtent;
MagickOffsetType
savedpos,
currentpos;
ssize_t
... | {
"deleted": [
{
"line_no": 173,
"char_start": 4538,
"char_end": 4572,
"line": " while (len--)\n"
},
{
"line_no": 204,
"char_start": 5742,
"char_end": 5776,
"line": " while (len--)\n"
}
],
"added": [
{
... | {
"deleted": [],
"added": [
{
"char_start": 4570,
"char_end": 4574,
"chars": " > 0"
},
{
"char_start": 5778,
"char_end": 5782,
"chars": " > 0"
}
]
} | github.com/ImageMagick/ImageMagick/commit/97c9f438a9b3454d085895f4d1f66389fd22a0fb | coders/meta.c | cwe-125 |
ParseDsdiffHeaderConfig | int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)
{
int64_t infilesize, total_samples;
DFFFileHeader dff_file_header;
DFFChunkHeader dff_chunk_header;
uint32_t bcount;
infilesize = DoGetFileSize (infile);
memcpy (&dff_file_hea... | int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)
{
int64_t infilesize, total_samples;
DFFFileHeader dff_file_header;
DFFChunkHeader dff_chunk_header;
uint32_t bcount;
infilesize = DoGetFileSize (infile);
memcpy (&dff_file_hea... | {
"deleted": [
{
"line_no": 77,
"char_start": 3244,
"char_end": 3322,
"line": " char *prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);\n"
}
],
"added": [
{
"line_no": 77,
"char_start": 3244,
"char_end": 3274,
"line": " ch... | {
"deleted": [],
"added": [
{
"char_start": 3272,
"char_end": 3654,
"chars": ";\n\n if (dff_chunk_header.ckDataSize < 4 || dff_chunk_header.ckDataSize > 1024) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n ... | github.com/dbry/WavPack/commit/36a24c7881427d2e1e4dc1cef58f19eee0d13aec | cli/dsdiff.c | cwe-125 |
name_parse | name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
int name_end = -1;
int j = *idx;
int ptr_count = 0;
#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, p... | name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
int name_end = -1;
int j = *idx;
int ptr_count = 0;
#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, p... | {
"deleted": [
{
"line_no": 20,
"char_start": 830,
"char_end": 860,
"line": "\t\tif (j >= length) return -1;\n"
}
],
"added": [
{
"line_no": 40,
"char_start": 1425,
"char_end": 1466,
"line": "\t\tif (j + label_len > length) return -1;\n"
}
]
} | {
"deleted": [
{
"char_start": 832,
"char_end": 862,
"chars": "if (j >= length) return -1;\n\t\t"
}
],
"added": [
{
"char_start": 1412,
"char_end": 1453,
"chars": ") return -1;\n\t\tif (j + label_len > length"
}
]
} | github.com/libevent/libevent/commit/96f64a022014a208105ead6c8a7066018449d86d | evdns.c | cwe-125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.