Permalink
Browse files

getProcessUsername() should check whether the username is empty or NULL.

Some user databases are apparently broken to that amount.
  • Loading branch information...
1 parent 2f6be3f commit 9756f992cd1c6d8e6333a508b4f353aa8306f43b @FooBarWidget FooBarWidget committed Apr 25, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 ext/common/Utils.cpp
@@ -391,7 +391,7 @@ getProcessUsername() {
result = (struct passwd *) NULL;
}
- if (result == (struct passwd *) NULL) {
+ if (result == (struct passwd *) NULL || result->pw_name == NULL || result->pw_name[0] == '\0') {
snprintf(strings, sizeof(strings), "UID %lld", (long long) getuid());
strings[sizeof(strings) - 1] = '\0';
return strings;

0 comments on commit 9756f99

Please sign in to comment.