@@ -7051,9 +7051,10 @@ static bool checkSpecial(TEXT* const p, const int length, const double value)
70517051 if (setValues.List) {
70527052 isqlGlob.printf("%s%s", t, NEWLINE);
70537053 }
7054- // We're working under the assumption that length is the maximum number of characters to produce,
7055- // and that the available buffer is at least 1 byte longer for nul-termination.
7056- const size_t bufSize = static_cast<size_t>(length) + 1;
7054+ // We're working under the assumption that length is the maximum number of characters to
7055+ // produce of the value, and that the available buffer is at least 2 bytes longer for
7056+ // a space (column separator) and nul-termination.
7057+ const size_t bufSize = static_cast<size_t>(length) + 2;
70577058 snprintf(p, bufSize, "%*.*s ", length, length, t);
70587059
70597060 return true;
@@ -7139,7 +7140,7 @@ static unsigned print_item(TEXT** s, const IsqlVar* var, const unsigned length)
71397140 blobid = var->value.blobid;
71407141 snprintf(blobbuf, sizeof(blobbuf), "%" xLONGFORMAT":%" xLONGFORMAT,
71417142 blobid->gds_quad_high, blobid->gds_quad_low);
7142- snprintf(p, bufSize, "%*s ", MIN (17, length), blobbuf);
7143+ snprintf(p, bufSize, "%*s ", MAX (17, length), blobbuf);
71437144 break;
71447145
71457146 case SQL_BLOB:
@@ -7149,7 +7150,7 @@ static unsigned print_item(TEXT** s, const IsqlVar* var, const unsigned length)
71497150 blobid = var->value.blobid;
71507151 snprintf(blobbuf, sizeof(blobbuf), "%" xLONGFORMAT":%" xLONGFORMAT,
71517152 blobid->gds_quad_high, blobid->gds_quad_low);
7152- snprintf(p, bufSize, "%*s ", MIN (17, length), blobbuf);
7153+ snprintf(p, bufSize, "%*s ", MAX (17, length), blobbuf);
71537154 if (setValues.List)
71547155 {
71557156 isqlGlob.printf("%s%s", blobbuf, NEWLINE);
@@ -7718,6 +7719,7 @@ static void print_item_numeric(SINT64 value, int length, int scale, TEXT* buf)
77187719 **************************************/
77197720 // We're working under the assumption that length is the maximum number of characters to
77207721 // produce, and that the available buffer is at least 1 byte longer for nul-termination.
7722+ // Contrary to elsewhere, here we don't need to add one byte for a column separator.
77217723 const size_t bufSize = static_cast<size_t>(length) + 1;
77227724 // Handle special case of no negative scale, no '.' required!
77237725 if (scale >= 0)
0 commit comments