Ver código fonte

Don't complain when callers provide too-short buffers for

PXENV_GET_CACHED_INFO.  NTLDR does this.
tags/v0.9.3
Michael Brown 16 anos atrás
pai
commit
6b0e147e0d
1 arquivos alterados com 6 adições e 7 exclusões
  1. 6
    7
      src/interface/pxe/pxe_preboot.c

+ 6
- 7
src/interface/pxe/pxe_preboot.c Ver arquivo

@@ -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;

Carregando…
Cancelar
Salvar