]> git.ozlabs.org Git - petitboot/commitdiff
lib/file: Avoid off-by-one error in array
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 19 Mar 2018 23:03:19 +0000 (10:03 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Fri, 23 Mar 2018 00:39:35 +0000 (11:39 +1100)
Fixes Coverity defect CIDs 143606, 143610

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
lib/file/file.c

index 0d187887c701f75183fcec4550f33cb292a9198a..57a251901a5afd1dbc1234313af2b1827d65f685 100644 (file)
@@ -37,7 +37,7 @@ int copy_file_secure_dest(void *ctx, const char *source_file,
                char **destination_file)
 {
        char readlink_buffer[MAX_FILENAME_SIZE + 1];
                char **destination_file)
 {
        char readlink_buffer[MAX_FILENAME_SIZE + 1];
-       char dest_filename[MAX_FILENAME_SIZE] = "";
+       char dest_filename[MAX_FILENAME_SIZE + 1] = "";
        char template[] = "/tmp/petitbootXXXXXX";
        FILE *destination_handle, *source_handle;
        int destination_fd, result = 0;
        char template[] = "/tmp/petitbootXXXXXX";
        FILE *destination_handle, *source_handle;
        int destination_fd, result = 0;