lsteamclient: Convert callbacks with a best guess even if specified message length is too short.

CW-Bug-Id: #23620
This commit is contained in:
Paul Gofman 2024-03-27 11:40:32 -06:00
parent ccc1fda889
commit 3cba1580fe

View File

@ -698,8 +698,8 @@ void *alloc_callback_wtou( int id, void *callback, int *callback_len )
if (!best)
{
WARN( "len %d is too small for callback %d.\n", *callback_len, id );
return callback;
ERR( "len %d is too small for callback %d, using default.\n", *callback_len, id );
best = find_first_callback_def_by_id( id );
}
if (best->w_callback_len != *callback_len)
WARN( "Found len %d for id %d, len %d.\n", best->w_callback_len, id, *callback_len );
@ -726,7 +726,10 @@ void convert_callback_utow(int id, void *u_callback, int u_callback_len, void *w
best = c;
break;
}
if (!best && c->u_callback_len == u_callback_len && c->w_callback_len <= w_callback_len)
if ((!best || best->w_callback_len > w_callback_len)
&& c->u_callback_len == u_callback_len && c->w_callback_len <= w_callback_len)
best = c;
if (!best && c->u_callback_len == u_callback_len)
best = c;
++c;
}