From 345f9d635e6b815a2d7e0c1f102e556d57b25f07 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Tue, 14 Aug 2007 16:26:09 +0000 Subject: [PATCH] Prevent segfault on wrong data (gsoap doesn't guard it). --- org.glite.jp.index/Makefile | 2 +- org.glite.jp.index/src/db_ops.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/org.glite.jp.index/Makefile b/org.glite.jp.index/Makefile index b8b0b06..ba5a0d2 100644 --- a/org.glite.jp.index/Makefile +++ b/org.glite.jp.index/Makefile @@ -62,7 +62,7 @@ SRCS:= conf.c bones_server.c soap_ops.c soap_ps_calls.c common.c \ ${is_prefix}Server.c ${ps_prefix}Client.c ${ws_prefix}C.c \ ws_ps_typeref.c ws_is_typeref.c db_ops.c context.c common_server.c -EXA_TEST_SRCS:=jpis-test.c ${is_prefix}Client.c ${is_prefix}C.c context.c db_ops.c conf.c ws_is_typeref.c +EXA_TEST_SRCS:=jpis-test.c ${is_prefix}Client.c ${is_prefix}C.c context.c common.c db_ops.c conf.c ws_is_typeref.c EXA_DB_SRCS:=jpis-db-internal.c db_ops.c conf.c context.c ws_is_typeref.c EXA_CLIENT_SRCS:=jpis-client.c ${is_prefix}Client.c ${is_prefix}C.c common.c diff --git a/org.glite.jp.index/src/db_ops.c b/org.glite.jp.index/src/db_ops.c index 807fe45..b6353eb 100644 --- a/org.glite.jp.index/src/db_ops.c +++ b/org.glite.jp.index/src/db_ops.c @@ -18,6 +18,7 @@ #include "conf.h" #include "context.h" #include "db_ops.h" +#include "common.h" #ifndef LOG_SQL @@ -647,6 +648,10 @@ int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *ps, const cha lprintf("\n"); + if (!jobid || !owner) { + glite_jpis_stack_error(ctx->jpctx, EINVAL, "jobid and owner is mandatory (jobid=%s, owner=%s)!\n", jobid, owner); + goto fail; + } md5_jobid = str2md5(jobid); md5_cert = str2md5(owner); GLITE_JPIS_PARAM(ctx->param_jobid, ctx->param_jobid_len, md5_jobid); -- 1.8.2.3