]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/invalid-ids'
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 30 Dec 2016 14:58:41 +0000 (15:58 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 30 Dec 2016 15:00:38 +0000 (16:00 +0100)
A single patch that was in misc for a while, and two follow up fixups
that were detected after the branch was merged into next.

* refs/heads/t/invalid-ids (cooking for two weeks):
  Makefile: Don't compile with -Wformat-signedness unconditionally.
  aft.c: Use correct format string for error output.
  touch: Refuse to set an invalid image or lyrics ID.

NEWS.md
aft.c
blob.c

diff --git a/NEWS.md b/NEWS.md
index a7af771744e91e3654bd216b217f40a56eae11ea..3d00528d123929d78d4895a5a57fd748c085cdad 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -15,6 +15,7 @@ NEWS
 - The wma decoder and audio format handler now correctly decodes
   files with unusual block sizes.
 - We now compile with -Wformat-signedness if possible.
+- The touch command now refuses to set an invalid image or lyrics ID.
 
 Download: [tarball](./releases/paraslash-git.tar.bz2)
 
@@ -42,6 +43,7 @@ not mentioned here have accumulated and are also part of the release.
 - para_gui no longer reports 100% playing time at the stream start.
 - Opus cleanups.
 
+Downloads:
 [tarball](./releases/paraslash-0.5.6.tar.bz2),
 [signature](./releases/paraslash-0.5.6.tar.bz2.asc)
 
diff --git a/aft.c b/aft.c
index 77891342313e17295d5b60ea836fd9b187705ae9..bfcd1fb0162fe8a8a03c0f5ba165acc60be71cf0 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -2044,6 +2044,22 @@ static int com_touch_callback(struct afs_callback_arg *aca)
                .data = aca,
                .action = touch_audio_file
        };
+       if (cto->image_id >= 0) {
+               ret = img_get_name_by_id(cto->image_id, NULL);
+               if (ret < 0) {
+                       para_printf(&aca->pbout, "invalid image ID: %d\n",
+                               cto->image_id);
+                       return ret;
+               }
+       }
+       if (cto->lyrics_id >= 0) {
+               ret = lyr_get_name_by_id(cto->lyrics_id, NULL);
+               if (ret < 0) {
+                       para_printf(&aca->pbout, "invalid lyrics ID: %d\n",
+                               cto->lyrics_id);
+                       return ret;
+               }
+       }
        if (cto->flags & TOUCH_FLAG_FNM_PATHNAME)
                pmd.fnmatch_flags |= FNM_PATHNAME;
        ret = for_each_matching_row(&pmd);
diff --git a/blob.c b/blob.c
index 7a7ae756cb834ef998f37b8b88a781537392e4d3..ed684428aba55ae848c58fe8c96af2c900f4d6b9 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -487,7 +487,8 @@ static int blob_get_name_by_id(struct osl_table *table, uint32_t id,
        struct osl_object obj = {.data = &id, .size = sizeof(id)};
        int ret;
 
-       *name = NULL;
+       if (name)
+               *name = NULL;
        if (!id)
                return 1;
        ret = osl(osl_get_row(table, BLOBCOL_ID, &obj, &row));
@@ -498,7 +499,8 @@ static int blob_get_name_by_id(struct osl_table *table, uint32_t id,
                return ret;
        if (*(char *)obj.data == '\0')
                return -E_DUMMY_ROW;
-       *name = (char *)obj.data;
+       if (name)
+               *name = (char *)obj.data;
        return 1;
 }