hessu / aprsc

aprsc, a core APRS-IS server
125 stars 40 forks source link

Guard against null dereference when no workers are running #42

Closed fkautz closed 7 years ago

PhirePhly commented 7 years ago

I usually assume 0 is an int data type. I'd rather use NULL for checking pointer equivalency.

fkautz commented 7 years ago

I've updated the PR to use NULL instead of 0

hessu commented 7 years ago

Hmm, it logs a LOG_INFO message but does not actually guard or return from the function, was that intentional?

If workers_running > 0 && worker_threads == NULL, it's quite a critical corruption at that point, might make sense to log at LOG_CRIT level and abort() out.

fkautz commented 7 years ago

@hessu I've updated the patch to log at CRIT level and abort as recommended.

hessu commented 7 years ago

Thank you, merged!