diff options
author | trociny <trociny@FreeBSD.org> | 2011-05-08 09:31:17 +0000 |
---|---|---|
committer | trociny <trociny@FreeBSD.org> | 2011-05-08 09:31:17 +0000 |
commit | 6ff3f50607bff026acc295516739ec2e7b4c2bf8 (patch) | |
tree | fcb6d29aa6d2583b484746a866c7bdc52270678e /sbin/hastd/parse.y | |
parent | 2b4c44d1c234d2e9eb67e025a20d80e9e925eb99 (diff) | |
download | FreeBSD-src-6ff3f50607bff026acc295516739ec2e7b4c2bf8.zip FreeBSD-src-6ff3f50607bff026acc295516739ec2e7b4c2bf8.tar.gz |
Fix isitme(), which is used to check if node-specific configuration
belongs to our node, and was returning false positive if the first
part of a node name matches short hostname.
Approved by: pjd (mentor)
Diffstat (limited to 'sbin/hastd/parse.y')
-rw-r--r-- | sbin/hastd/parse.y | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/hastd/parse.y b/sbin/hastd/parse.y index 91e4870..8cf6ed9 100644 --- a/sbin/hastd/parse.y +++ b/sbin/hastd/parse.y @@ -92,8 +92,10 @@ isitme(const char *name) * Now check if it matches first part of the host name. */ pos = strchr(buf, '.'); - if (pos != NULL && pos != buf && strncmp(buf, name, pos - buf) == 0) + if (pos != NULL && (size_t)(pos - buf) == strlen(name) && + strncmp(buf, name, pos - buf) == 0) { return (1); + } /* * At the end check if name is equal to our host's UUID. |