dahdi-linux
dahdi-linux copied to clipboard
Dahdi-linux: Improper use of string operations
I'm looking at various string constructs in (for example) drivers/dahdi/dahdi-base.c:
strncat(vi.echo_canceller + strlen(vi.echo_canceller),
ec_name, space);
which doesn't make sense. strncat(s1, s2, n) already finds the strlen(s1) when doing the append. This is redundant. Either do:
strncat(vi.echo_canceller,
ec_name, space);
or:
strncpy(vi.echo_canceller + strlen(vi.echo_canceller),
ec_name, space);
Is this the only improper string operation you found? Your comment seems to imply there may be multiple. I don't see other instances of this type of misusage though.
$ grep -R "strncat"
drivers/dahdi/dahdi-base.c: strncat(vi.echo_canceller + strlen(vi.echo_canceller),
drivers/dahdi/dahdi-base.c: strncat(vi.echo_canceller + strlen(vi.echo_canceller),