With the patch more complete patch from FreeBSD (just more logging info, no other logic changes from first patch), I get the following logs:
May 27 10:58:49.152479 afpd[18141] {ad_open.c:1639} (error:ad): ad_entry_check_size overflow (122 + 32 > 0)
May 27 10:58:49.152605 afpd[18141] {ad_open.c:1655} (error:ad): ad_entry: not valid
So, it would appear that ad->valid_data_len
is 0
prior to ad_entry_check_size()
getting called. I don't know enough about the code to say wether that's normal or not. :-/
Anywho, here's the patch for curious:
--- libatalk/adouble/ad_open.c.orig 2022-05-26 17:51:48.604464910 -0400
+++ libatalk/adouble/ad_open.c 2022-05-27 10:51:33.467798497 -0400
@@ -1574,6 +1574,8 @@
uint32_t required_len;
if (eid >= ADEID_MAX) {
+ LOG(log_error, logtype_ad, "ad_entry_check_size %d is greater than %d",
+ eid, ADEID_MAX);
return false;
}
if (got_len == 0) {
@@ -1585,6 +1587,7 @@
* Shouldn't happen: implicitly initialized to zero because
* explicit initializer missing.
*/
+ LOG(log_error, logtype_ad, "ad_entry_check_size explicit initializer missing");
return false;
}
if (ad_checks[eid].expected_len == -1) {
@@ -1594,6 +1597,8 @@
if (ad_checks[eid].fixed_size) {
if (ad_checks[eid].expected_len != got_len) {
/* Wrong size fo fixed size entry. */
+ LOG(log_error, logtype_ad, "ad_entry_check_size wrong size to fixed size entry (%d != %d)",
+ ad_checks[eid].expected_len, got_len);
return false;
}
required_len = got_len;
@@ -1604,12 +1609,16 @@
* Too small for variable sized entry with
* minimum size.
*/
+ LOG(log_error, logtype_ad, "ad_entry_check_size too small for variable sized entry (%d < %d)",
+ got_len, ad_checks[eid].expected_len);
return false;
}
required_len = got_len;
} else {
if (got_len > ad_checks[eid].expected_len) {
/* Too big for variable sized entry. */
+ LOG(log_error, logtype_ad, "ad_entry_check_size too big for variable sized entry (%d > %d)",
+ got_len, ad_checks[eid].expected_len);
return false;
}
/*
@@ -1621,10 +1630,14 @@
}
if (off + required_len < off) {
/* wrap around */
+ LOG(log_error, logtype_ad, "ad_entry_check_size wrap around (%d + %d < %d)",
+ off, required_len, off);
return false;
}
if (off + required_len > bufsize) {
/* overflow */
+ LOG(log_error, logtype_ad, "ad_entry_check_size overflow (%d + %d > %d)",
+ off, required_len, bufsize);
return false;
}
return true;
@@ -1639,10 +1652,7 @@
valid = ad_entry_check_size(eid, bufsize, off, len);
if (!valid) {
- return NULL;
- }
-
- if (off == 0 || len == 0) {
+ LOG(log_error, logtype_ad, "ad_entry: not valid");
return NULL;
}
Pinned Comments
denn commented on 2024-10-07 09:59 (UTC) (edited on 2024-10-20 12:31 (UTC) by denn)
As version 4.0.0-1 switched to
db5.3
as suggested by product documentation. This will makecnid_bdb
to re-create all db files after upgrade.