File: fix-buf-overflow.patch

package info (click to toggle)
icom 20120228-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,584 kB
  • sloc: ansic: 4,070; cpp: 3,322; xml: 112; csh: 64; makefile: 39; awk: 37
file content (20 lines) | stat: -rw-r--r-- 336 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Fix buffer overlow
patch from Ryan Barber <rfb@skyscraper.nu>

--- a/radio.c
+++ b/radio.c
@@ -1017,11 +1017,11 @@
 	)
 {
 	int	i;
-	char	s1[11];
+	char	s1[12];
 	char	*y;
 
-	sprintf(s1, " %10.0lf", freq);
-	y = s1 + 10;
+	snprintf(s1, sizeof(s1), " %10.0lf", freq);
+	y = s1 + 11;
 	i = 0;
 	while (*y != ' ') {
 		x[i] = *y-- & 0xf;