[PATCH 1/6] POWERPC: use KSYM_NAME_LEN



Use KSYM_NAME_LEN instead of numeric value.
Actually because of too small 'tmp' there is
a potential buffer overflow.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
---

Index: linux-2.6.git/arch/powerpc/xmon/xmon.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/xmon/xmon.c 2008-01-23 19:04:42.000000000 +0300
+++ linux-2.6.git/arch/powerpc/xmon/xmon.c 2008-01-23 19:12:45.000000000 +0300
@@ -69,7 +69,7 @@ static unsigned long ndump = 64;
static unsigned long nidump = 16;
static unsigned long ncsum = 4096;
static int termch;
-static char tmpstr[128];
+static char tmpstr[KSYM_NAME_LEN];

#define JMP_BUF_LEN 23
static long bus_error_jmp[JMP_BUF_LEN];
@@ -2354,7 +2354,7 @@ scanhex(unsigned long *vp)
}
} else if (c == '$') {
int i;
- for (i=0; i<63; i++) {
+ for (i = 0; i < sizeof(tmpstr) / 2; i++) {
c = inchar();
if (isspace(c)) {
termch = c;
@@ -2467,7 +2467,7 @@ symbol_lookup(void)
{
int type = inchar();
unsigned long addr;
- static char tmp[64];
+ static char tmp[KSYM_NAME_LEN];

switch (type) {
case 'a':
@@ -2476,7 +2476,7 @@ symbol_lookup(void)
termch = 0;
break;
case 's':
- getstring(tmp, 64);
+ getstring(tmp, sizeof(tmp));
if (setjmp(bus_error_jmp) == 0) {
catch_memory_errors = 1;
sync();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Compiling .java files
    ... public static native String PE_GetSmartCode(String targetStr, int ... public static native StringPE_GetPhonemes(String targetStr, ... phonemesSize, String targetStr, int type, int mode); ...
    (comp.lang.java.programmer)
  • Re: panic: kmem_map too small
    ... endeavour:~# sysctl hw.busdma ... static void bge_tick; ... int type; ...
    (freebsd-stable)
  • [PATCH][SELINUX] 1/2 sock_create_kern()
    ... The patch below adds a function sock_create_kernfor use when the kernel ... indicating whether the socket being created is a kernel socket or not. ... -static inline int security_socket_create (int family, int type, int protocol) ...
    (Linux-Kernel)
  • [patch 2/4] permission mapping for sys_syslog operations
    ... to a smaller set of privilege codes before calling security modules. ... This patch changes the security module interface! ... int cap_syslog ... static int dummy_syslog (int type) ...
    (Linux-Kernel)
  • Re: Data Types
    ... So why use a 32 byte char when you can use a 4 byte INT? ... Andrew J. Kelly ... let alone the Int type. ... >> Steve, ...
    (microsoft.public.sqlserver.programming)