Index: CHANGELOG =================================================================== RCS file: /cvsroot/u-boot/u-boot/CHANGELOG,v retrieving revision 1.424 diff -p -u -r1.424 CHANGELOG --- CHANGELOG 7 Feb 2005 19:44:17 -0000 1.424 +++ CHANGELOG 8 Feb 2005 23:10:21 -0000 @@ -2,6 +2,10 @@ Changes for U-Boot 1.1.3: ====================================================================== +* Patch by Andrew Dyer, Tue Feb 8 17:06:43 CST 2005 + fix strswab to exit if either of the two characters to be swapped is + a null + * Fix cirrus voltage detection (for CPC45) * Fix byteorder problem in usbboot and scsiboot commands. Index: lib_generic/string.c =================================================================== RCS file: /cvsroot/u-boot/u-boot/lib_generic/string.c,v retrieving revision 1.4 diff -p -u -r1.4 string.c --- lib_generic/string.c 14 Mar 2004 01:00:01 -0000 1.4 +++ lib_generic/string.c 8 Feb 2005 23:10:44 -0000 @@ -374,17 +374,17 @@ char * strsep(char **s, const char *ct) */ char *strswab(const char *s) { - char *p; + char *p, *q; if ((NULL == s) || ('\0' == *s)) { return (NULL); } - for (p = ((char *)s + 1); '\0' != *p; p += 2) { + for (p = ((char *)s), q = p + 1; ((*p != '\0') && (*q != '\0')); p += 2, q += 2) { char tmp; - tmp = *(p-1); - *(p-1) = *p; - *p = tmp; + tmp = *p; + *p = *q; + *q = tmp; } return (char *) s;