mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Improved NULL checking in strreplace()
This commit is contained in:
parent
ed9b548d6e
commit
c60129ed78
1
HISTORY
1
HISTORY
@ -4201,3 +4201,4 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed a crash after executing the SVDRP command CLRE, caused by dangling 'schedule'
|
- Fixed a crash after executing the SVDRP command CLRE, caused by dangling 'schedule'
|
||||||
pointers from cChannel objects (reported by Malte Schröder).
|
pointers from cChannel objects (reported by Malte Schröder).
|
||||||
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
|
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
|
||||||
|
- Improved NULL checking in strreplace().
|
||||||
|
17
tools.c
17
tools.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: tools.c 1.111 2006/01/15 16:42:37 kls Exp $
|
* $Id: tools.c 1.112 2006/01/20 14:01:28 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
@ -138,13 +138,14 @@ char *strn0cpy(char *dest, const char *src, size_t n)
|
|||||||
|
|
||||||
char *strreplace(char *s, char c1, char c2)
|
char *strreplace(char *s, char c1, char c2)
|
||||||
{
|
{
|
||||||
char *p = s;
|
if (s) {
|
||||||
|
char *p = s;
|
||||||
while (p && *p) {
|
while (*p) {
|
||||||
if (*p == c1)
|
if (*p == c1)
|
||||||
*p = c2;
|
*p = c2;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user