+/**************************************************************************************************
+ * Wrapper functions for the *VAL macros with bound checking
+ **************************************************************************************************/
+
+static int sivalc(char *buf, off_t off, off_t maxoff, uint32_t val)
+{
+ if (off + sizeof(val) >= maxoff) {
+ LOG(log_error, logtype_sl, "sivalc: off: %zd, maxoff: %zd", off, maxoff);
+ return -1;
+ }
+ SIVAL(buf, off, val);
+ return 0;
+}
+
+static int slvalc(char *buf, off_t off, off_t maxoff, uint64_t val)
+{
+ if (off + sizeof(val) >= maxoff) {
+ LOG(log_error, logtype_sl, "slvalc: off: %zd, maxoff: %zd", off, maxoff);
+ return -1;
+ }
+ SLVAL(buf, off, val);
+ return 0;
+}
+