diff options
author | George Burgess IV <gbiv@google.com> | 2016-03-08 07:41:39 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-03-08 07:41:39 +0000 |
commit | 02f689e11a3686e045c16b3a54f6b2ff243c0549 (patch) | |
tree | 2be83c160dfe683917edafc603195b7358401c12 /gatekeeperd | |
parent | af777ae7c34b7c30b47cb0e35dc57a47961fa8db (diff) | |
parent | 3368bdebba02316710bafc5bce120eec388365fb (diff) | |
download | system_core-02f689e11a3686e045c16b3a54f6b2ff243c0549.tar.gz system_core-02f689e11a3686e045c16b3a54f6b2ff243c0549.tar.bz2 system_core-02f689e11a3686e045c16b3a54f6b2ff243c0549.zip |
Merge "Cleanup uses of sprintf so we can deprecate it." am: 2c5b89a64a
am: 3368bdebba
* commit '3368bdebba02316710bafc5bce120eec388365fb':
Cleanup uses of sprintf so we can deprecate it.
Diffstat (limited to 'gatekeeperd')
-rw-r--r-- | gatekeeperd/gatekeeperd.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gatekeeperd/gatekeeperd.cpp b/gatekeeperd/gatekeeperd.cpp index b4fdab0c5..7254cf2f3 100644 --- a/gatekeeperd/gatekeeperd.cpp +++ b/gatekeeperd/gatekeeperd.cpp @@ -76,7 +76,7 @@ public: void store_sid(uint32_t uid, uint64_t sid) { char filename[21]; - sprintf(filename, "%u", uid); + snprintf(filename, sizeof(filename), "%u", uid); int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR); if (fd < 0) { ALOGE("could not open file: %s: %s", filename, strerror(errno)); @@ -102,7 +102,7 @@ public: void maybe_store_sid(uint32_t uid, uint64_t sid) { char filename[21]; - sprintf(filename, "%u", uid); + snprintf(filename, sizeof(filename), "%u", uid); if (access(filename, F_OK) == -1) { store_sid(uid, sid); } @@ -111,7 +111,7 @@ public: uint64_t read_sid(uint32_t uid) { char filename[21]; uint64_t sid; - sprintf(filename, "%u", uid); + snprintf(filename, sizeof(filename), "%u", uid); int fd = open(filename, O_RDONLY); if (fd < 0) return 0; read(fd, &sid, sizeof(sid)); @@ -121,7 +121,7 @@ public: void clear_sid(uint32_t uid) { char filename[21]; - sprintf(filename, "%u", uid); + snprintf(filename, sizeof(filename), "%u", uid); if (remove(filename) < 0) { ALOGE("%s: could not remove file [%s], attempting 0 write", __func__, strerror(errno)); store_sid(uid, 0); |