diff --git a/compctld.c b/compctld.c index abe33e5c2f2646a1e99ca038b75c707599e507d0..690170c85b39a03da07e56329395683876f499f5 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);