Welcome to little lamb

Code » anopa » commit c371ecc

start/stop: Fix issues on 32bit systems

author Olivier Brunel
2016-09-23 10:49:36 UTC
committer Olivier Brunel
2016-09-23 10:49:36 UTC
parent ef89b32bb52ec57988d81c9d734783e6d8ecff6f

start/stop: Fix issues on 32bit systems

Size used as length of filename (string constant) was wrong because a
ternary was used as expression for sizeof, leading to it being
sizeof(char *) instead of the size of the string constant, which on
32bit resulted in truncated string being used; See bug report #7 for more
details.

Thanks to John O'M.; Closes #7

src/libanopa/exec_oneshot.c +1 -1

diff --git a/src/libanopa/exec_oneshot.c b/src/libanopa/exec_oneshot.c
index 22c3cb0..d8de381 100644
--- a/src/libanopa/exec_oneshot.c
+++ b/src/libanopa/exec_oneshot.c
@@ -43,7 +43,7 @@ _exec_oneshot (int si, aa_mode mode)
     aa_service *s = aa_service (si);
     int is_start = (mode & AA_MODE_START) ? 1 : 0;
     char * const filename = (is_start) ? AA_START_FILENAME : AA_STOP_FILENAME;
-    int l_fn = sizeof ((is_start) ? AA_START_FILENAME : AA_STOP_FILENAME);
+    int l_fn = (is_start) ? sizeof(AA_START_FILENAME) : sizeof(AA_STOP_FILENAME);
     int l_sn = strlen (aa_service_name (s));
     char buf[l_sn + 1 +l_fn];
     struct stat st;