Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't pass null variables to snprintf. #944

Merged
merged 1 commit into from
Nov 16, 2017
Merged

Conversation

ddpbsd
Copy link
Member

@ddpbsd ddpbsd commented Sep 1, 2016

New logging from OpenBSD alerted me to the problem:

Sep  1 13:48:12 ix ossec-dbd: vfprintf %s NULL in "INSERT INTO alert(server_id,rule_id,level,timestamp,location_id,src_ip,src_port,dst_ip,dst_port,alertid,"user",full_log) VALUES ('%u', '%u','%u','%u', '%u', '%s', '%u', '%s', '%u', '%s', '%s', '%s')"
Sep  1 13:51:37 ix ossec-dbd: vfprintf %s NULL in "%s: DEBUG: Connecting to '%s', using '%s', '%s', '%s', %d,'%s'."
Sep  1 13:51:42 ix ossec-dbd: vfprintf %s NULL in "REPLACE INTO signature(rule_id, level, description) VALUES ('%u','%u','%s')"
Sep  1 13:53:01 ix ossec-dbd: vfprintf %s NULL in "REPLACE INTO signature(rule_id, level, description) VALUES ('%u','%u','%s')"

I'm not entirely sure it's all fixed yet, but putting this here so I at least don't forget about it.


This change is Reviewable

@@ -167,8 +167,10 @@ int OS_Alert_InsertDB(const alert_data *al_data, DBConfig *db_config)
db_config->server_id, al_data->rule,
al_data->level,
(unsigned int)time(0), *loc_id,
al_data->srcip, (unsigned short)s_port,
al_data->dstip, (unsigned short)d_port,
al_data->srcip,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like just a formatting change.

@atomicturtle atomicturtle merged commit 9795c71 into ossec:master Nov 16, 2017
@ddpbsd ddpbsd deleted the null_db branch November 26, 2018 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants