diff options
author | Simon Rettberg | 2018-09-25 11:19:57 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-09-25 11:19:57 +0200 |
commit | 11fba5772434ccc30f1e3a73bfd7074ef110cf41 (patch) | |
tree | a2d50de8fa2329c7b0a2cc516f616b076714ce41 | |
parent | Merge branch 'master' into openslx (diff) | |
download | ipxe-11fba5772434ccc30f1e3a73bfd7074ef110cf41.tar.gz ipxe-11fba5772434ccc30f1e3a73bfd7074ef110cf41.tar.xz ipxe-11fba5772434ccc30f1e3a73bfd7074ef110cf41.zip |
[settings] Fix md5 buffer size handling
Return value is treated like snprintf, so returing ENOSPC doesn't make
any sense.
-rw-r--r-- | src/core/settings.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/settings.c b/src/core/settings.c index df4fe9fc..bfe618d9 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -2165,8 +2165,8 @@ static int format_md5_setting ( const struct setting_type *type __unused, struct md5_context ctx; uint8_t digest[MD5_DIGEST_SIZE]; - if ( len < MD5_DIGEST_SIZE ) - return -ENOSPC; + if ( len < MD5_DIGEST_SIZE * 2 ) + return MD5_DIGEST_SIZE * 2; digest_init ( &md5_algorithm, &ctx ); digest_update ( &md5_algorithm, &ctx, raw, raw_len ); digest_final ( &md5_algorithm, &ctx, digest ); |