]> Cypherpunks repositories - gostls13.git/commitdiff
path/filepath: deprecate HasPrefix
authorJoe Tsai <joetsai@digital-static.net>
Fri, 16 Dec 2016 21:35:51 +0000 (13:35 -0800)
committerJoe Tsai <thebrokentoaster@gmail.com>
Fri, 16 Dec 2016 22:30:12 +0000 (22:30 +0000)
Use the new "Deprecated:" syntax for all instances of HasPrefix.
This is a follow-up to http://golang.org/cl/28413 which only modified path_unix.go.

In this CL, we avoid mentioning that strings.HasPrefix should be used since
that function is still subtly wrong in security applications.

See http://golang.org/cl/5712045 for more information.

Fixes #18355

Change-Id: I0d0306152cd0b0ea5110774c2c78117515b9f5cd
Reviewed-on: https://go-review.googlesource.com/34554
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/path/filepath/path_plan9.go
src/path/filepath/path_unix.go
src/path/filepath/path_windows.go

index 60d46d9d421d21efb821a06afbffbb14c26bc343..ec792fc831aefbb77380fa27aef591b2fd1f3430 100644 (file)
@@ -18,6 +18,9 @@ func volumeNameLen(path string) int {
 }
 
 // HasPrefix exists for historical compatibility and should not be used.
+//
+// Deprecated: HasPrefix does not respect path boundaries and
+// does not ignore case when required.
 func HasPrefix(p, prefix string) bool {
        return strings.HasPrefix(p, prefix)
 }
index dddcac0a5c774f9b7179f889f545d6e72a062516..d77ff24cdc3186d64295b9ea06d361002a96edf1 100644 (file)
@@ -21,7 +21,8 @@ func volumeNameLen(path string) int {
 
 // HasPrefix exists for historical compatibility and should not be used.
 //
-// Deprecated: Use strings.HasPrefix instead.
+// Deprecated: HasPrefix does not respect path boundaries and
+// does not ignore case when required.
 func HasPrefix(p, prefix string) bool {
        return strings.HasPrefix(p, prefix)
 }
index 359703de2695390da242f154a74e21f892f078e0..0d8b62015c56846883da962fe319df7b33635fa9 100644 (file)
@@ -65,6 +65,9 @@ func volumeNameLen(path string) int {
 }
 
 // HasPrefix exists for historical compatibility and should not be used.
+//
+// Deprecated: HasPrefix does not respect path boundaries and
+// does not ignore case when required.
 func HasPrefix(p, prefix string) bool {
        if strings.HasPrefix(p, prefix) {
                return true