Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions cf-agent/verify_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
#include <cf3.defs.h>
#include <fsattrs.h>
#include <override_fsattrs.h>
#include <logging.h>
#include <stddef.h>
#include <string.h>

static PromiseResult FindFilePromiserObjects(EvalContext *ctx, const Promise *pp);
static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promise *pp);
Expand Down Expand Up @@ -1136,12 +1139,28 @@ PromiseResult ScheduleEditOperation(EvalContext *ctx, char *filename,
if ((vp = PromiseGetConstraintAsRval(pp, "edit_line", RVAL_TYPE_FNCALL)))
{
fp = (FnCall *) vp;
strcpy(edit_bundle_name, fp->name);
size_t ret = strlcpy(edit_bundle_name, fp->name, sizeof(edit_bundle_name));
if (ret >= sizeof(edit_bundle_name))
{
RecordFailure(ctx, pp, a,
"The edit_line bundle name is too long (%zu >= %zu)",
ret, sizeof(edit_bundle_name));
result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL);
goto exit;
}
args = fp->args;
}
else if ((vp = PromiseGetConstraintAsRval(pp, "edit_line", RVAL_TYPE_SCALAR)))
{
strcpy(edit_bundle_name, (char *) vp);
size_t ret = strlcpy(edit_bundle_name, (char *) vp, sizeof(edit_bundle_name));
if (ret >= sizeof(edit_bundle_name))
{
RecordFailure(ctx, pp, a,
"The edit_line bundle name is too long (%zu >= %zu)",
ret, sizeof(edit_bundle_name));
result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL);
goto exit;
}
args = NULL;
}
else
Expand Down Expand Up @@ -1174,12 +1193,28 @@ PromiseResult ScheduleEditOperation(EvalContext *ctx, char *filename,
if ((vp = PromiseGetConstraintAsRval(pp, "edit_xml", RVAL_TYPE_FNCALL)))
{
fp = (FnCall *) vp;
strcpy(edit_bundle_name, fp->name);
size_t ret = strlcpy(edit_bundle_name, fp->name, sizeof(edit_bundle_name));
if (ret >= sizeof(edit_bundle_name))
{
RecordFailure(ctx, pp, a,
"The edit_xml bundle name is too long (%zu >= %zu)",
ret, sizeof(edit_bundle_name));
result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL);
goto exit;
}
args = fp->args;
}
else if ((vp = PromiseGetConstraintAsRval(pp, "edit_xml", RVAL_TYPE_SCALAR)))
{
strcpy(edit_bundle_name, (char *) vp);
size_t ret = strlcpy(edit_bundle_name, (char *) vp, sizeof(edit_bundle_name));
if (ret >= sizeof(edit_bundle_name))
{
RecordFailure(ctx, pp, a,
"The edit_xml bundle name is too long (%zu >= %zu)",
ret, sizeof(edit_bundle_name));
result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL);
goto exit;
}
args = NULL;
}
else
Expand Down
Loading