]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
vconsole-setup: Store fonts on heap (#3268)
authorKyle Russell <bkylerussell@gmail.com>
Mon, 16 May 2016 14:41:30 +0000 (09:41 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 16 May 2016 14:41:30 +0000 (10:41 -0400)
More friendly to the stack.

src/vconsole/vconsole-setup.c

index 8a1b824e65d9bfa1fe1feb362fafc090bafbc48f..08ae4aad275be384fd1c9ab2732034d46a2bc7e5 100644 (file)
@@ -195,9 +195,15 @@ static void font_copy_to_all_vcs(int fd) {
         unsigned char map8[E_TABSZ];
         unsigned short map16[E_TABSZ];
         struct unimapdesc unimapd;
-        struct unipair unipairs[USHRT_MAX];
+        _cleanup_free_ struct unipair* unipairs = NULL;
         int i, r;
 
+        unipairs = new(struct unipair, USHRT_MAX);
+        if (unipairs == NULL) {
+                log_error("Not enough memory to copy fonts");
+                return;
+        }
+
         /* get active, and 16 bit mask of used VT numbers */
         r = ioctl(fd, VT_GETSTATE, &vcs);
         if (r < 0) {