aboutsummaryrefslogtreecommitdiffstats
path: root/src/names.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/names.c')
-rw-r--r--src/names.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/names.c b/src/names.c
index f9a7817..089df5f 100644
--- a/src/names.c
+++ b/src/names.c
@@ -31,20 +31,21 @@
* @param name the name to check
* @return the length of the name or zero if invalid
*/
-size_t
+uint8_t
agent_check_name(
const char *name
) {
char c;
- size_t length = 0;
+ uint8_t length = 0;
+
if (name) {
while ((c = name[length])) {
- if (length > UINT8_MAX
- || (!isalnum(c) && !strchr("@_-$", c))) {
+ if (!isalnum(c) && !strchr("@_-$", c)) {
length = 0;
break;
}
- length++;
+ if (!++length)
+ break;
}
}
return length;