|
@@ -168,15 +168,14 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
|
168
|
168
|
get_cached_info->BufferLimit );
|
169
|
169
|
} else {
|
170
|
170
|
/* Copy packet to client buffer */
|
171
|
|
- if ( len < sizeof ( cached_info[idx] ) ) {
|
172
|
|
- DBG ( " buffer too short" );
|
173
|
|
- goto err;
|
174
|
|
- }
|
|
171
|
+ if ( len > sizeof ( cached_info[idx] ) )
|
|
172
|
+ len = sizeof ( cached_info[idx] );
|
|
173
|
+ if ( len < sizeof ( cached_info[idx] ) )
|
|
174
|
+ DBG ( " buffer may be too short" );
|
175
|
175
|
buffer = real_to_user ( get_cached_info->Buffer.segment,
|
176
|
176
|
get_cached_info->Buffer.offset );
|
177
|
|
- copy_to_user ( buffer, 0, &cached_info[idx],
|
178
|
|
- sizeof ( cached_info[idx] ) );
|
179
|
|
- get_cached_info->BufferSize = sizeof ( cached_info[idx] );
|
|
177
|
+ copy_to_user ( buffer, 0, &cached_info[idx], len );
|
|
178
|
+ get_cached_info->BufferSize = len;
|
180
|
179
|
}
|
181
|
180
|
|
182
|
181
|
get_cached_info->Status = PXENV_STATUS_SUCCESS;
|