~ubuntu-branches/ubuntu/vivid/oss4/vivid-proposed

« back to all changes in this revision

Viewing changes to debian/patches/003_linux-error-logging-fixes.patch

  • Committer: Package Import Robot
  • Author(s): Sebastien NOEL
  • Date: 2012-11-19 11:47:24 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20121119114724-svu8mq7x3pk64nez
Tags: 4.2-build2007-1
* New upstream release.
* Acknowledge NMU, thanks Michael Gilbert.
* Add debian/patches/110_ld-as-needed.patch: Rearrange order of linker
  arguments to fix building with "ld --as-needed" (closes: #630737).
* Add missing dependency on dpkg-dev to oss4-dkms and oss4-source
  (closes: #687086).
* Fix typo in the changelog (closes: #628876, #675933)
* Add debian/patches/002_fix-linux-oss_native_word.patch (closes: #693657).
  Thanks to Ben Hutchings.
* Add debian/patches/003_linux-error-logging-fixes.patch (closes: #693657).
  Thanks to Ben Hutchings.
* check for /lib/modules/${kernelver}/build in addition of
  /lib/modules/${kernelver}/source (closes: #587191).
* oss4-dkms.dkms.in: fix 'CLEAN' rules (closes: #653374).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Ben Hutchings <ben@decadent.org.uk>
 
2
Subject: Linux error logging fixes
 
3
 
 
4
The Linux implementation of oss_cmn_err() uses a fixed-size temporary
 
5
buffer and does not protect against overflow.  Although this is not
 
6
obviously exploitable, it could well become exploitable in future.
 
7
 
 
8
The argument counting and copying is also unportable and generally
 
9
incorrect.
 
10
 
 
11
Therefore:
 
12
- If we are not going to edit the log line in any way, just call
 
13
  vprintk() and don't bother with the temporary buffer.
 
14
- If we need to edit the log line or call panic() instead of printk(),
 
15
  use vsnprintf() instead of printf().
 
16
 
 
17
---
 
18
--- a/setup/Linux/oss/build/osscore.c
 
19
+++ b/setup/Linux/oss/build/osscore.c
 
20
@@ -633,43 +633,24 @@ oss_create_uio (uio_t * uio, char *buf,
 
21
 void
 
22
 oss_cmn_err (int level, const char *s, ...)
 
23
 {
 
24
-  char tmp[1024], *a[6];
 
25
+  char tmp[1024];
 
26
   va_list ap;
 
27
-  int i, n = 0;
 
28
 
 
29
   va_start (ap, s);
 
30
 
 
31
-  for (i = 0; i < strlen (s); i++)
 
32
-    if (s[i] == '%')
 
33
-      n++;
 
34
-
 
35
-  for (i = 0; i < n && i < 6; i++)
 
36
-    a[i] = va_arg (ap, char *);
 
37
-
 
38
-  for (i = n; i < 6; i++)
 
39
-    a[i] = NULL;
 
40
-
 
41
   if (level == CE_CONT)
 
42
     {
 
43
-      sprintf (tmp, s, a[0], a[1], a[2], a[3], a[4], a[5], NULL,
 
44
-              NULL, NULL, NULL);
 
45
-      printk ("%s", tmp);
 
46
+      vprintk (s, ap);
 
47
     }
 
48
   else
 
49
     {
 
50
       strcpy (tmp, "osscore: ");
 
51
-      sprintf (tmp + strlen (tmp), s, a[0], a[1], a[2], a[3], a[4], a[5],
 
52
-              NULL, NULL, NULL, NULL);
 
53
+      vsnprintf (tmp + strlen (tmp), sizeof(tmp) - strlen(tmp), s, ap);
 
54
       if (level == CE_PANIC)
 
55
        panic (tmp);
 
56
 
 
57
       printk (KERN_ALERT "%s", tmp);
 
58
     }
 
59
-#if 0
 
60
-  /* This may cause a crash under SMP */
 
61
-  if (sound_started)
 
62
-    store_msg (tmp);
 
63
-#endif
 
64
 
 
65
   va_end (ap);
 
66
 }