чување c08bf6b7c39422effeee33da068694a0309e54be
родитељ 542748cadb4f6e30f1dbabdf272649ee5d575ec4
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 13 Aug 2021 16:56:07 +0200
Fix: possible buffer overflows detected with -O3
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 4(+), брисања: 4(-)
diff --git a/index.html b/index.html
@@ -152,7 +152,7 @@ this program. If not, see <<a href="https://www.gnu.org/licenses">https://www
<div id="git-log">
Previous commit:
-index.slw c995f21 2021-08-12 09:06:45 +0200 (Страхиња Радић) (HEAD -> master, origin/master, origin/HEAD)
+index.slw 542748c 2021-08-13 15:43:09 +0200 (Страхиња Радић) (HEAD -> master, origin/master, origin/HEAD)
</div><!--git-log-->
diff --git a/slweb.c b/slweb.c
@@ -502,7 +502,7 @@ process_git_log(FILE* output)
return warning(1, (u8*)"Cannot use 'git-log' in stdin");
char* basename = NULL;
- size_t basename_size = strlen(input_filename) + 1;
+ size_t basename_size = BUFSIZE;
CALLOC(basename, char, basename_size);
char* slash = strrchr(input_filename, '/');
pid_t result = 0;
@@ -1884,7 +1884,7 @@ process_inline_footnote(u8* token, BOOL read_yaml_macros_and_links, FILE* output
token_len + 1);
strncpy((char*)inline_footnotes[inline_footnote_count - 1],
- (char*)token, token_len);
+ (char*)token, token_len+1);
*(inline_footnotes[inline_footnote_count - 1] + token_len) = 0;
}
else
@@ -4262,7 +4262,7 @@ done_line:
pfootnotes->value_size);
strncpy((char*)pfootnotes->value,
(char*)token,
- pfootnotes->value_size - 1);
+ pfootnotes->value_size);
}
skip_footnote_text_read:;
}