sizeof only works on statically created pointers, not pointers that are
passed as parameters to the function.
The referenced commit unfortunately didn't follow this and we got
truncated names. Thanks to Hector Martin for pointing the problem out.
References:
commit
1e2f38a202798a78554ae5f5d12f697f3607f89f
psmisc/psmisc#14
lencomm = endcomm - startcomm;
if (lencomm < 0)
lencomm = 0;
- if (lencomm > sizeof comm -1)
- lencomm = sizeof comm -1;
+ if (lencomm > COMM_LEN -1)
+ lencomm = COMM_LEN -1;
strncpy(comm, startcomm, lencomm);
comm[lencomm] = '\0';