1.1 --- a/core/sm_stringutil.cpp Sun Oct 21 17:58:35 2007 +0000
1.2 +++ b/core/sm_stringutil.cpp Sun Oct 21 20:06:30 2007 +0000
1.3 @@ -154,6 +154,8 @@
1.4
1.5 if (max_params)
1.6 {
1.7 + cell_t new_params[MAX_TRANSLATE_PARAMS];
1.8 +
1.9 /* Check if we're going to over the limit */
1.10 if ((*arg) + (max_params - 1) > (size_t)params[0])
1.11 {
1.12 @@ -164,12 +166,18 @@
1.13 goto error_out;
1.14 }
1.15
1.16 - /* Re-order the parameters that this translation requires */
1.17 - ReorderTranslationParams(&pTrans, const_cast<cell_t *>(¶ms[*arg]));
1.18 + /* If we need to re-order the parameters, do so with a temporary array.
1.19 + * Otherwise, we could run into trouble with continual formats, a la ShowActivity().
1.20 + */
1.21 + memcpy(new_params, params, sizeof(cell_t) * (params[0] + 1));
1.22 + ReorderTranslationParams(&pTrans, &new_params[*arg]);
1.23 +
1.24 + return atcprintf(buffer, maxlen, pTrans.szPhrase, pCtx, new_params, arg);
1.25 }
1.26 -
1.27 - /* Now, call back into atcprintf() which is re-entrant */
1.28 - return atcprintf(buffer, maxlen, pTrans.szPhrase, pCtx, params, arg);
1.29 + else
1.30 + {
1.31 + return atcprintf(buffer, maxlen, pTrans.szPhrase, pCtx, params, arg);
1.32 + }
1.33
1.34 error_out:
1.35 *error = true;