changeset 31775:5a18f4d3b062

Fill out struct utsname on win32 using g_strlcpy instead of strcpy. Thanks to the Electronic Frontier Foundation (https://www.eff.org/) for this patch.
author Ethan Blanton <elb@pidgin.im>
date Sun, 17 Jul 2011 20:52:50 +0000
parents 4ad2a0668687
children eb7dfb01640d
files libpurple/protocols/jabber/win32/posix.uname.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/win32/posix.uname.c	Sun Jul 17 20:36:15 2011 +0000
+++ b/libpurple/protocols/jabber/win32/posix.uname.c	Sun Jul 17 20:52:50 2011 +0000
@@ -54,7 +54,7 @@
   GetVersionEx ( &OS_version );
   GetSystemInfo ( &System_Info );
 
-  strcpy( uts->sysname, "WIN32_" );
+  g_strlcpy( uts->sysname, "WIN32_" , sizeof(uts->sysname));
   switch( OS_version.dwPlatformId )
   {
     case VER_PLATFORM_WIN32_NT:
@@ -92,13 +92,13 @@
   switch( System_Info.wProcessorArchitecture )
   {
     case PROCESSOR_ARCHITECTURE_PPC:
-      strcpy( uts->machine, "ppc" );
+      g_strlcpy( uts->machine, "ppc" , sizeof( uts->machine ) );
       break;
     case PROCESSOR_ARCHITECTURE_ALPHA:
-      strcpy( uts->machine, "alpha" );
+      g_strlcpy( uts->machine, "alpha" , sizeof( uts->machine ) );
       break;
     case PROCESSOR_ARCHITECTURE_MIPS:
-      strcpy( uts->machine, "mips" );
+      g_strlcpy( uts->machine, "mips" , sizeof( uts->machine ) );
       break;
     case PROCESSOR_ARCHITECTURE_INTEL:
       /* dwProcessorType is only valid in Win95 and Win98
@@ -115,7 +115,7 @@
               sprintf( uts->machine, "i%ld", System_Info.dwProcessorType );
               break;
             default:
-              strcpy( uts->machine, "i386" );
+              g_strlcpy( uts->machine, "i386" , sizeof( uts->machine ) );
               break;
           }
           break;
@@ -123,12 +123,12 @@
 	  sprintf( uts->machine, "i%d86", System_Info.wProcessorLevel );
 	  break;
 	default:
-	  strcpy( uts->machine, "unknown" );
+	  g_strlcpy( uts->machine, "unknown" , sizeof( uts->machine ) );
 	  break;
       }
       break;
     default:
-      strcpy( uts->machine, "unknown" );
+      g_strlcpy( uts->machine, "unknown" , sizeof( uts->machine ) );
       break;
   }