]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib: avoid format truncation
authorChristian Göttsche <cgzones@googlemail.com>
Mon, 11 Dec 2023 16:53:28 +0000 (17:53 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 14 Dec 2023 13:40:40 +0000 (07:40 -0600)
    commonio.c: In function 'commonio_unlock':
    commonio.c:487:49: warning: '.lock' directive output may be truncated writing 5 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
      487 |                 snprintf (lock, sizeof lock, "%s.lock", db->filename);
          |                                                 ^~~~~
    commonio.c:487:17: note: 'snprintf' output between 6 and 1029 bytes into a destination of size 1024
      487 |                 snprintf (lock, sizeof lock, "%s.lock", db->filename);
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/commonio.c

index b3106103fdea9c64dedbf2395a87a3f01ea50329..9afe5de014768e601bf55284f441c5360901f29d 100644 (file)
@@ -467,7 +467,7 @@ static void dec_lock_count (void)
 
 int commonio_unlock (struct commonio_db *db)
 {
-       char lock[1024];
+       char lock[1029];
 
        if (db->isopen) {
                db->readonly = true;