strstr() considered harmful, part 541
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 21 Sep 2010 10:14:20 +0000 (13:14 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 21 Sep 2010 10:14:20 +0000 (13:14 +0300)
- buf isn't const here, it's modified through pointer acquired through
  strstr() which silently casts away the const.

build/files.c

index 52b114b..d16b0eb 100644 (file)
@@ -259,7 +259,7 @@ static VFA_t const verifyAttrs[] = {
  * @param fl           package file tree walk data
  * @return             RPMRC_OK on success
  */
-static rpmRC parseForVerify(const char * buf, FileList fl)
+static rpmRC parseForVerify(char * buf, FileList fl)
 {
     char *p, *pe, *q = NULL;
     const char *name;
@@ -356,7 +356,7 @@ exit:
  * @param fl           package file tree walk data
  * @return             RPMRC_OK on success
  */
-static rpmRC parseForDev(const char * buf, FileList fl)
+static rpmRC parseForDev(char * buf, FileList fl)
 {
     const char * name;
     const char * errstr = NULL;
@@ -452,7 +452,7 @@ exit:
  * @param fl           package file tree walk data
  * @return             0 on success
  */
-static rpmRC parseForAttr(const char * buf, FileList fl)
+static rpmRC parseForAttr(char * buf, FileList fl)
 {
     const char *name;
     char *p, *pe, *q = NULL;
@@ -606,7 +606,7 @@ exit:
  * @param fl           package file tree walk data
  * @return             RPMRC_OK on success
  */
-static rpmRC parseForConfig(const char * buf, FileList fl)
+static rpmRC parseForConfig(char * buf, FileList fl)
 {
     char *p, *pe, *q = NULL;
     const char *name;
@@ -681,7 +681,7 @@ static int langCmp(const void * ap, const void * bp)
  * @param fl           package file tree walk data
  * @return             RPMRC_OK on success
  */
-static rpmRC parseForLang(const char * buf, FileList fl)
+static rpmRC parseForLang(char * buf, FileList fl)
 {
     char *p, *pe, *q = NULL;
     const char *name;
@@ -774,7 +774,7 @@ exit:
  * @param fl           package file tree walk data
  * @return             RPMRC_OK on success
  */
-static rpmRC parseForCaps(const char * buf, FileList fl)
+static rpmRC parseForCaps(char * buf, FileList fl)
 {
     char *p, *pe, *q = NULL;
     const char *name;