1.1 --- a/libfsserver/lib/generic/simple_pager.cc Mon Feb 27 14:46:13 2023 +0100
1.2 +++ b/libfsserver/lib/generic/simple_pager.cc Tue Feb 28 22:35:25 2023 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * A simple pager exposing a single memory region.
1.6 *
1.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -23,6 +23,8 @@
1.13
1.14 #include <mem/memory_incremental.h>
1.15
1.16 +#include <string.h>
1.17 +
1.18 #include "dataspace_server.h"
1.19 #include "ipc.h"
1.20 #include "simple_pager.h"
1.21 @@ -48,6 +50,25 @@
1.22 }
1.23 }
1.24
1.25 +
1.26 +
1.27 +/* Data access methods. */
1.28 +
1.29 +char *SimplePager::get_string(offset_t offset)
1.30 +{
1.31 + char *buffer = _region->read(offset);
1.32 + offset_t size = _region->size();
1.33 +
1.34 + /* Confine the path to the limit of the buffer. */
1.35 +
1.36 + if ((buffer != NULL) && (strnlen(buffer, size) < size))
1.37 + return buffer;
1.38 + else
1.39 + return NULL;
1.40 +}
1.41 +
1.42 +
1.43 +
1.44 /* Map a flexpage corresponding to the dataspace 'offset' involving a 'hot_spot'
1.45 (flexpage offset). */
1.46