Skip to content

Commit

Permalink
datasource/cmdline: Work around an unconventional execve() call (with…
Browse files Browse the repository at this point in the history
… a NULL argv)
  • Loading branch information
bostjan committed Oct 17, 2021
1 parent fef1ce0 commit 5017e1f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@



2021-xx-xx - Version 2.4.xx
---------------------------
o Bugfix (GH #201):
Work around DirectAdmin's non-conventional execve() call (null argv).
(Thanks to Yavuz Aydin (@yavuzaydin @ GitHub) for reporting this issue and
for providing access to a reproduction environment to aid the investigation.)



2021-04-20 - Version 2.4.14
---------------------------
o Bugfix (GH #198):
Expand Down
7 changes: 7 additions & 0 deletions src/datasource/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ int snoopy_datasource_cmdline (char * const result, char const * const arg)
/* Get argument data of execv/e() call */
snoopy_inputdatastorage = snoopy_inputdatastorage_get();

/* DirectAdmin does not follow the execve() convention (as described in its man page)
and passes NULL argv instead of what it's supposed to do. Let's work around that. */
if (snoopy_inputdatastorage->argv == NULL) {
n = snprintf(result, SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE, "%s", snoopy_inputdatastorage->filename);
return n;
}

/* Count number of arguments */
for (cmdLineArgCount=0 ; *(snoopy_inputdatastorage->argv+cmdLineArgCount) != (char *) 0 ; cmdLineArgCount++);

Expand Down

0 comments on commit 5017e1f

Please sign in to comment.