summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2008-01-07 14:50:32 +0100
committerMichael Brown2008-01-07 14:50:32 +0100
commit33111697075e60cec522848c0f04fd397bc9ea8d (patch)
tree9d7c8541da992f0d1b8283f98aa788c5809e8a56
parentUse .SECONDARY instead of .PRECIOUS for bin/%.tmp targets. (diff)
downloadipxe-33111697075e60cec522848c0f04fd397bc9ea8d.tar.gz
ipxe-33111697075e60cec522848c0f04fd397bc9ea8d.tar.xz
ipxe-33111697075e60cec522848c0f04fd397bc9ea8d.zip
When the DHCP file/sname fields are empty, don't allow them to override
their equivalent DHCP-option-specified values.
-rw-r--r--src/net/udp/dhcp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 2fdb943c..b10c3ee7 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -368,11 +368,11 @@ static size_t dhcp_field_len ( const void *data, size_t max_len ) {
* @v max_len Field length
* @v tag DHCP option tag, or 0
*
- * If @c tag is non-zero, the field will be treated as a
- * NUL-terminated string representing the value of the specified DHCP
- * option. If @c tag is zero, the field will be treated as a block of
- * DHCP options, and simply appended to the existing options in the
- * option block.
+ * If @c tag is non-zero (and the field is not empty), the field will
+ * be treated as a NUL-terminated string representing the value of the
+ * specified DHCP option. If @c tag is zero, the field will be
+ * treated as a block of DHCP options, and simply appended to the
+ * existing options in the option block.
*
* The caller must ensure that there is enough space in the options
* block to perform the merge.
@@ -385,7 +385,9 @@ static void merge_dhcp_field ( struct dhcp_option_block *options,
struct dhcp_option *end;
if ( tag ) {
- set_dhcp_option ( options, tag, data, strlen ( data ) );
+ len = strlen ( data );
+ if ( len )
+ set_dhcp_option ( options, tag, data, len );
} else {
len = dhcp_field_len ( data, max_len );
dest = ( options->data + options->len - 1 );