projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix invalid read when fetching sys files with very long string variables.
[pspp-builds.git]
/
src
/
data
/
variable.c
diff --git
a/src/data/variable.c
b/src/data/variable.c
index 56993e461c5d43998105123767037bba1a9be16d..ee6c8747865b734cf0ba0f2eb00bdd543a39040c 100644
(file)
--- a/
src/data/variable.c
+++ b/
src/data/variable.c
@@
-432,6
+432,8
@@
copy_mangle (char *dst, size_t dst_size,
int
width_to_bytes(int width)
{
int
width_to_bytes(int width)
{
+ const int chunks = width / EFFECTIVE_LONG_STRING_LENGTH ;
+ const int remainder = width - (chunks * EFFECTIVE_LONG_STRING_LENGTH) ;
int bytes, mod8;
assert (width >= 0);
int bytes, mod8;
assert (width >= 0);
@@
-442,9
+444,6
@@
width_to_bytes(int width)
if ( width <= MAX_LONG_STRING)
return MAX_SHORT_STRING * DIV_RND_UP(width, MAX_SHORT_STRING);
if ( width <= MAX_LONG_STRING)
return MAX_SHORT_STRING * DIV_RND_UP(width, MAX_SHORT_STRING);
- const int chunks = width / EFFECTIVE_LONG_STRING_LENGTH ;
-
- const int remainder = width - (chunks * EFFECTIVE_LONG_STRING_LENGTH) ;
bytes = remainder + (chunks * (MAX_LONG_STRING + 1) );
bytes = remainder + (chunks * (MAX_LONG_STRING + 1) );