6fb2bbaa0d
1/ Do not read past the terminating null byte when hashing the name. 2/ S[x] is used as an index, but S is "char *S" (signed) and hence may index the array out-of-bounds. Bit-mask S[x] with 127 (the array has 128 entries). 3/ Use a size_t for j, not an int (strlen() returns a size_t). Notes: - These are (mostly) theoretical problems, because the contents of /proc/PID/status are (mostly) trusted. - The "name" member of the status_table_struct has 8 bytes, and "RssShmem" occupies exactly 8 bytes, which means that "name" is not null-terminated. This is fine right now, because status2proc() uses memcmp(), not strcmp(), but it is worth mentioning.