Namaste misc,
Question:
In the makeconn function in src/usr.bin/rdist/docmd.c, should the 5 in
the following line be replaced by 4?
...
static int
makeconn(char *rhost)
{
...
(void) snprintf(buf, sizeof(buf), "%.*s -S",
(int)(sizeof(buf)-5), path_rdistd);
...
Explanation:
I have a limited ability to read code, so I may be wrong here.
If I am not wrong, strings are terminated with '\0' which I think is a
single byte. So, in the above case, the sizeof(" -S" + '\0')=4. But the
code has 5.
I am not sure of my "'\0' is a single byte" part, and hence my query.
Dhanyavaad,
ab
[1] - https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/rdist/docmd.c?rev=1.34
---------|---------|---------|---------|---------|---------|---------|--
No comments:
Post a Comment