]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: windres: buffer overflow in bin_to_res_toolbar
authorAlan Modra <amodra@gmail.com>
Tue, 15 Apr 2025 23:25:04 +0000 (08:55 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 16 Apr 2025 05:07:17 +0000 (14:37 +0930)
Commit 9e68cae4fdfb broke the check I added in commit 4846e543de95.
Add missing "return NULL".

binutils/resbin.c

index 1698e144d5059385413ab405f8d217d5a8f969a9..65bdb3499e28b21cf78912b9d0615d7f1ac23815 100644 (file)
@@ -1460,7 +1460,10 @@ bin_to_res_toolbar (windres_bfd *wrbfd, const bfd_byte *data,
     it = (rc_toolbar_item *) res_alloc (sizeof (rc_toolbar_item));
     it->id.named = 0;
     if (length < 4)
-      toosmall (_("toolbar item"));
+      {
+       toosmall (_("toolbar item"));
+       return NULL;
+      }
     it->id.u.id = (int) windres_get_32 (wrbfd, data, 4);
     it->prev = it->next = NULL;
     data += 4;