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

Non functional code #707

Open
michaelortmann opened this Issue Oct 15, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@michaelortmann
Member

michaelortmann commented Oct 15, 2018

in main.c
since the oldest version here on github, there is code like:

	  if (dcc[idx].type && dcc[idx].type->activity)
	    dcc[idx].type->activity(idx, buf, i);
	  else
	    putlog(LOG_MISC, "*",
		   "!!! untrapped dcc activity: type %s, sock %d",
		   dcc[idx].type->name, dcc[idx].sock);

later there was traffic stats added and other stuff changed, but the non functional code stays more or less the same.
what i mean is that:

if (dcc[idx].type [...]
else
  dcc[idx].type->name [...]

looks like in (if) there is a check for null pointer, but then in (else) the pointer is accessed
it never was a problem, because the error handling was never triggert.
looks like the error handling was built in but never tested.

we should rip it out completely or change it,
in its current shape it does no good for us.

(found with the help of Clang static analyzer)

@Cizzle

This comment has been minimized.

Member

Cizzle commented Oct 24, 2018

That's funny indeed, I'd keep it though and put something alike:

putlog(LOG_MISC, "*", "!!! untrapped dcc activity: type %s, sock %d",
       dcc[idx].type ? dcc[idx].type->name : "Unknown", dcc[idx].sock);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment