Commit a2de6043 authored by Sergei Golubchik's avatar Sergei Golubchik

ASAN error in CONNECT engine

don't strcpy a string to itself
parent 2ed882f9
...@@ -1627,6 +1627,12 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp) ...@@ -1627,6 +1627,12 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp)
return (n > 0) ? 1 : (n < 0) ? -1 : 0; return (n > 0) ? 1 : (n < 0) ? -1 : 0;
} // end of CompareValue } // end of CompareValue
static inline void v_strcpy(char *dest, const char *src)
{
if (dest != src)
strcpy(dest, src);
}
/***********************************************************************/ /***********************************************************************/
/* Compute a function on a string. */ /* Compute a function on a string. */
/***********************************************************************/ /***********************************************************************/
...@@ -1651,11 +1657,11 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) ...@@ -1651,11 +1657,11 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
break; break;
case OP_MIN: case OP_MIN:
assert(np == 2); assert(np == 2);
strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]); v_strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
break; break;
case OP_MAX: case OP_MAX:
assert(np == 2); assert(np == 2);
strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]); v_strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
break; break;
default: default:
// sprintf(g->Message, MSG(BAD_EXP_OPER), op); // sprintf(g->Message, MSG(BAD_EXP_OPER), op);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment