right. here's a patch. Jeff On Mon, 2004-08-02 at 11:22 -0400, Dan Winship wrote: > On Mon, 2004-08-02 at 10:46 -0400, Rodney Dawes wrote: > > This patch fixes the following warning in e-pkcs12.c: > > > > e-pkcs12.c: In function `prompt_for_password': > > e-pkcs12.c:243: warning: passing arg 2 of `memcpy' makes pointer from > > integer without a cast > > > > This can cause problems on 64-bit machines. > > This is not a 64-bit problem. The problem is that the big-endian branch > of that code is completely wrong (and your patch doesn't fix it. Among > other things, note that uni isn't even initialized). > > -- Dan > > > _______________________________________________ > evolution-patches mailing list > evolution-patches lists ximian com > http://lists.ximian.com/mailman/listinfo/evolution-patches > -- Jeffrey Stedfast Evolution Hacker - Novell, Inc. fejj ximian com - www.novell.com
? patch
Index: e-pkcs12.c
===================================================================
RCS file: /cvs/gnome/evolution/smime/lib/e-pkcs12.c,v
retrieving revision 1.4
diff -u -r1.4 e-pkcs12.c
--- e-pkcs12.c 11 Feb 2004 19:14:50 -0000 1.4
+++ e-pkcs12.c 2 Aug 2004 15:27:16 -0000
@@ -222,26 +222,23 @@
NULL);
if (passwd) {
- int len = g_utf8_strlen (passwd, -1);
- gunichar2 uni;
- int i;
- char *p;
-
+ size_t len = strlen (passwd);
+ const char *inptr = passwd;
+ char *outptr = pwd->data;
+ gunichar2 c;
+
SECITEM_AllocItem(NULL, pwd, sizeof (gunichar2) * (len + 1));
- memset (pwd->data, 0, sizeof (gunichar2) * (len + 1));
-
-#ifdef IS_LITTLE_ENDIAN
- p = passwd;
- for (i=0; i < len; i++) {
- uni = (gunichar2)(g_utf8_get_char (p) & 0xFFFF);
- p = g_utf8_next_char (p);
-
- pwd->data[2*i] = (unsigned char)(uni >> 8);
- pwd->data[2*i+1] = (unsigned char)(uni & 0xFF);
+
+ while (inptr && (c = (gunichar2) (g_utf8_get_char (inptr) & 0xffff))) {
+ inptr = g_utf8_next_char (inptr);
+ c = GUINT16_TO_BE (c);
+ *outptr++ = ((char *) &c)[0];
+ *outptr++ = ((char *) &c)[1];
}
-#else
- memcpy (pwd->data, uni, pwd->len-2);
-#endif
+
+ *outptr++ = 0;
+ *outptr++ = 0;
+
memset (passwd, 0, strlen (passwd));
g_free (passwd);
}
Attachment:
smime.p7s
Description: S/MIME cryptographic signature