summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2007-12-07 02:06:37 +0100
committerMichael Brown2007-12-07 02:06:37 +0100
commit6b0e147e0de3c3f2747d200a20e9a1327fac0cf4 (patch)
treef36c2a6bc8028aa7cce8b2b0d65ef01dc5c63b0d
parentFix a minor logical error in posix_io.c (diff)
downloadipxe-6b0e147e0de3c3f2747d200a20e9a1327fac0cf4.tar.gz
ipxe-6b0e147e0de3c3f2747d200a20e9a1327fac0cf4.tar.xz
ipxe-6b0e147e0de3c3f2747d200a20e9a1327fac0cf4.zip
Don't complain when callers provide too-short buffers for
PXENV_GET_CACHED_INFO. NTLDR does this.
-rw-r--r--src/interface/pxe/pxe_preboot.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/interface/pxe/pxe_preboot.c b/src/interface/pxe/pxe_preboot.c
index 5e6a6703..63451497 100644
--- a/src/interface/pxe/pxe_preboot.c
+++ b/src/interface/pxe/pxe_preboot.c
@@ -168,15 +168,14 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
get_cached_info->BufferLimit );
} else {
/* Copy packet to client buffer */
- if ( len < sizeof ( cached_info[idx] ) ) {
- DBG ( " buffer too short" );
- goto err;
- }
+ if ( len > sizeof ( cached_info[idx] ) )
+ len = sizeof ( cached_info[idx] );
+ if ( len < sizeof ( cached_info[idx] ) )
+ DBG ( " buffer may be too short" );
buffer = real_to_user ( get_cached_info->Buffer.segment,
get_cached_info->Buffer.offset );
- copy_to_user ( buffer, 0, &cached_info[idx],
- sizeof ( cached_info[idx] ) );
- get_cached_info->BufferSize = sizeof ( cached_info[idx] );
+ copy_to_user ( buffer, 0, &cached_info[idx], len );
+ get_cached_info->BufferSize = len;
}
get_cached_info->Status = PXENV_STATUS_SUCCESS;