From 6443fa05f73a9497c9f8f163b62bd57d7eef4dde Mon Sep 17 00:00:00 2001
From: Petr Baudis <pasky@ucw.cz>
Date: Wed, 7 Mar 2012 17:14:00 +0100
Subject: [PATCH] compctld: Remove bogus usage of sizeof() on strings

---
 compctld.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compctld.c b/compctld.c
index abe33e5..690170c 100644
--- a/compctld.c
+++ b/compctld.c
@@ -16,7 +16,7 @@
 #include "common.h"
 
 
-#define begins_with(s_, a_) (!strncmp(s_, a_, sizeof(s_) - 1))
+#define begins_with(s_, a_) (!strncmp(s_, a_, strlen(s_)))
 
 
 void
@@ -206,7 +206,7 @@ sockerror:
 				mprintf(fd, "1 blessed");
 
 		} else if (begins_with("stop ", line)) {
-			pid_t pid = atoi(line + sizeof("stop "));
+			pid_t pid = atoi(line + strlen("stop "));
 
 			/* Sanity check. */
 			if (pid < 10 || pid > 32768) {
@@ -243,7 +243,7 @@ sockerror:
 			free(tasks);
 
 		} else if (begins_with("limitmem ", line)) {
-			size_t limit = atol(line + sizeof("limitmem "));
+			size_t limit = atol(line + strlen("limitmem "));
 			size_t minuser, mincomp, maxcomp, total;
 			memory_limits(&minuser, &mincomp, &maxcomp, &total);
 
-- 
GitLab