From f4b218b50d745ea849a92a041da57cad4b6391c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 27 Apr 2011 10:04:26 +0100 Subject: [PATCH] Yap_ErrorMessage should never point at an atom! --- C/errors.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/C/errors.c b/C/errors.c index b4b688bf1..4d90de960 100755 --- a/C/errors.c +++ b/C/errors.c @@ -1831,9 +1831,13 @@ Yap_Error(yap_error_number type, Term where, char *format,...) if (type != PURE_ABORT) { /* This is used by some complex procedures to detect there was an error */ if (IsAtomTerm(nt[0])) { - Yap_ErrorMessage = RepAtom(AtomOfTerm(nt[0]))->StrOfAE; + strncpy(Yap_ErrorSay, RepAtom(AtomOfTerm(nt[0]))->StrOfAE, MAX_ERROR_MSG_SIZ\ +E); + Yap_ErrorMessage = Yap_ErrorSay; } else { - Yap_ErrorMessage = RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE; + strncpy(Yap_ErrorSay, RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE,\ + MAX_ERROR_MSG_SIZE); + Yap_ErrorMessage = Yap_ErrorSay; } } switch (type) {